The proper way of doing it..

I’ve been making a really simple FPS script and came across a problem. When using a mouse look script, a rigidbody’s rotation is freezed and therefore it will not rotate an object.

Here are the steps I take:

  1. Create a capsule
  2. Resize it and add a rigidbody (Freezing rotation on X and Z so the object doesn’t tip over)
  3. Add my movement script and camera script

However, when doing this, I see that the rotation of the rigidbody is locked by the script and wont move. So I disable the rigidbody and it works. The problem is now, I want to use gravity on my object. What would be the best way of going about this? I understand it’d probably mean editing the script, but I’m not too familiar with physics…

thanks,

~ Alex

  • When you lock the x and z rotation, your character should still be able to rotate around the y axis; Just making sure: If you want the camera to look up and down, you do not rotate the character around the x-axis.

-You can still work without a rigidbody, and use a Character Controller as these are much easier to use for characters, especially for first person characters. Look up Character Controller in the manual.

These are just some examples, there is no real proper way to do it and many different scripters have different solutions for a problem.

Hope that helped :wink:

rigidbody is compatible with scripts . I always use rigidbody and camera on my main character.

CharacterController is easyer but i don’t like it because isn’t physics based. And you can’t push objects without scripting.

Thanks for clearing this up. I’ve got it working now… well, to the point where the character is rotating along the Y axis when the camera does aswell… I’ll look for a fix for that.