I was just wondering what I need to do in order to use this premade camera (First Person Controller) to actually affect other objects. Let’s clarify this a bit. I want to use this controller to run into things like boxes. These boxes of course need to be pushed or fall once I run into them. Right now they don’t react at all and since I am a non-coder I am not sure what to do Any help?
Download the old “Physics Demo”–it contains a scene called “fps playground” that is pretty basic but it has boxes you run into and knock down with physics.
(Also, in “Other Examples” on that page are some other little scenes, including “First Person Movement.”)
Hopefully you’ll find some useful code to start from there.
Thanks for your answers guys. I still can’t get it to work properly. It seems like I get random results with it. The first person controller has two child objects (Graphics and main camera). I need to add a collider to the “Graphics” and the “parent”? I just tried it by only adding these components to the “Graphics” object but that didn’t work. I then placed a colider and rigidbody to the “parent” object and then it works (well not always). I must be doing something wrong. Maybe I am not understanding it fully here.
i don’t know much about the fps tut and this is all iirc but
I need to add a collider to the “Graphics” and the “parent”?
no. add a rigidbody to the cube you want to push. iirc the fps controller doesn’t use a rigidbody or collider at all.
if you look at the hierarchy of the fps tut it’s parented as
first person controller
graphics
main camera
weapons
none have colliders or rigidbodies attached. it uses a character controller instead which i think basically has the equivalent of a capsule type collider built in (not sure exactly). height and radius will affect it’s size. if you need more accurate collision (ie pushing the box with a hand) you’ll need to build it differently. maybe by attaching a physics rig (game empties with colliders attached) to a ragdoll or your animated model. you can still use the walker script but you’ll need to write your “push” script. hth
or you could start from scratch. Add Cube, capsule, plane. put the camera right at the top of capsule, and parent by dragging the camera onto the capsule in the hieracy window.Add a rigidbody to both capsule and cube, add the fps walker script to the capsule, and try dragging the mouselook(look in project window, in camera scripts)script from the project window onto either the camera or the capsule.
Try not to add too much other stuff as sometimes the bits and pieces can sort of contradict each other
AC
Hey Pete what does hth mean?