I’m creating a game and I’m encountering several issues. None are errors, but they aren’t functioning the way I want them too.
-
I have a crouching, walking and sprinting mechanic. When I walk or sprint the character motor updates properly. However, when I crouch, the character motor doesn’t update despite using the same code (just using different values).
-
I’m using a debug.drawray so I can see a visual representation of what the enemy sees. However, whenever the enemy rotates, the line doesn’t line-up properly with the z-axis.
Vector3 losLeft = transform.TransformDirection(Quaternion.Euler(0, -fieldOfViewRange, 0) * transform.forward).normalized * drawLine;Vector3 losRight = transform.TransformDirection(Quaternion.Euler(0, fieldOfViewRange, 0) * transform.forward).normalized * drawLine;Debug.DrawRay(transform.position, losLeft, Color.green);
Debug.DrawRay(transform.position, losRight, Color.green); -
I have a crossbow and when it fires, it doesn’t get stuck to a wall. Both the arrow and the wall have a collider. The bolt has a tag and I enable kinematic, translate it forward and then parent it to the object it hits.