PerEspen00 Posted May 5, 2017 Posted May 5, 2017 Is there any way to get add more collision for character controllers? Maybe create a box in the start function or something to make a bigger collision than the default cylinder(which really should get fixed). So I'm looking for a piece of code to use in the start function of my creature script so that I can create a box which will act as that creatures collision box for sword hits and general physics collision in the game. Any help appreciated! Quote
Genebris Posted May 5, 2017 Posted May 5, 2017 There is no way to change shape of character controller collider. The only workaround is to use regular rigidbody instead of character controller, but that brings many disadvantages. Quote
gamecreator Posted May 5, 2017 Posted May 5, 2017 There are many ways to detect if a sword hits a creature. Since you're using Lua, the easiest is probably CollisionTrigger. For general physics collisions, you could parent a box to a creature. Check out the code examples in the Entity docs, specifically SetShape and SetParent. However, the navigation system will ignore it so you might not get the effect you're hoping for. Quote
Genebris Posted May 5, 2017 Posted May 5, 2017 For general physics collisions, you could parent a box to a creature. Check out the code examples in the Entity docs, specifically SetShape and SetParent. However, the navigation system will ignore it so you might not get the effect you're hoping for. You can't attach collider as a child, this will break physics. Quote
PerEspen00 Posted May 6, 2017 Author Posted May 6, 2017 How about creating an independent collider and moving it with the creature? I need navmesh so I can't use rigidbody. This is the creature: https://www.3dmodels-textures.com/Creatures/CaveMonster Quote
Genebris Posted May 6, 2017 Posted May 6, 2017 It won't work, unless Josh adds ability to change character collider, you will have to use rigid body for anything like this. Quote
PerEspen00 Posted May 6, 2017 Author Posted May 6, 2017 So there is no way to use navmesh if the character isn't a cylinder shaped thing? That should really get fixed... kind of a game breaker. 1 Quote
Crazycarpet Posted May 6, 2017 Posted May 6, 2017 Yeah this big flaw plagues Unity engine as well, I think if Josh came up with a solution it'd be a nice leg up over Unity in that regard. Quote
macklebee Posted May 7, 2017 Posted May 7, 2017 The problem is with recast/detour. The navmesh needs certain data like character height/width/stepheight to determine if a path would be feasible, how close a path should be around walls, etc... If you had multiple character sizes then you would need multiple navmeshes - which means characters on different navmeshes would have no knowledge of each other. While I agree that having access to certain variables to control the character cylinder size would be ideal, then it would be an issue with navmeshes and what is passed to it prior to creation. The easiest solution (especially for 90% of users) was to hardcode this. Maybe one day Josh will allow us to control these variables for the controller and the navmeshes, but I would be surprised since this has been requested since LE3 with no luck. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
PerEspen00 Posted May 8, 2017 Author Posted May 8, 2017 Ok, I understand the problem. How about a way to check if a sword has hit a target? Could one create something in front of the player which checks for collision? Quote
Genebris Posted May 8, 2017 Posted May 8, 2017 You can do this using PhysicsSetPosition to move sword collider. 2 Quote
Josh Posted May 17, 2017 Posted May 17, 2017 The melee script uses a raycast. Box raycasting is used on the character to collide with his arms, legs, head, etc. This is in the monster and soldier AI scripts. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.