Forum rules - please read before posting.

first person Player parented to a rotating parent - spinning

I have a first person Player that is parented and moving around on a vehicle in motion. For example, inside a train car.  When the parent vehicle turns, the player goes into a spin. 

I suspect that it has something to do with the CursorHorizontal mouse input, somehow its not local or not relative to the first person camera or the Main camera( both are parented to the vehicle). 

Which script is getting the cursor screen position (CursorHorizontal)  and passing it to the Player?   

Camera.ScreenToWorldPoint is involved I would think?

setup:
Main Camera, Player, and first person camera are all parented to the moving parent.
Settings- movement method is set to first person.

I've tried Player script - motion control on all 3 settings and it still spins.

Thanks for any help!


Comments

  • Camera.ScreenToWorldPoint is generally only used when raycasting - i.e. clicking on Hotspots or NavMeshes.

    It is not used when free-aiming - only the delta change in the CursorHorizontal / CursorVertical inputs is used to determine the speed of change.

    Are you sure it is down to input?  Try modifying the inputs at runtime so that you can't invoke them (before the spinning) and see if it still spins.

    It may be a physics issue - does your Player have a Rigidbody?  Test what happens when you remove it.

    Parenting the MainCamera to anything can cause problems, however - you shouldn't have to parent it to the vehicle no matter what your player is doing.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.