Untouchable child objects of first person controller
Hi there,
I'm using fps controller from standard assets from Unity and as I'm creating fps game, I added hand and gun as child objects to this controller. I have colliders on gun and hand but I can go into everything. Other objects also have colliders. I noticed that, component of character controller I'd make bigger radius then everything is fine but...my player is too high for my map this way so I can't do that this way. Player is like over every object in game. I need this player to be not high so I have radius only set up for 0.22. So how can I make untouchable by hand and gun everything again as everything has their own collider already?
Answer by Mmmpies · Jun 11, 2016 at 04:45 PM
Try putting a capsule collider instead of a sphere as the radius doesn't affect the height of a capsule collider.
Where to put capsule collider? I don't have sphere collider anywhere. I've tried to put it on the player and centered where hand and pistol is but it was still that same. Later I've tried to put capsule collider on the gun and still that same.
I noticed that, component of character controller I'd make bigger radius then everything is fine
Whatever that is replace with a capsule collider, I am assu$$anonymous$$g it's a sphere collider though.
But it's first person view and if I delete character controller then I can't move my player at all even if I add capsule collider (ofc I checked this).
In that case I don't understand why you can't change the radius and set the height in the inspector. You have 2 fields so they should separate.
Even with height on 0 my player is too high for this map. And it's impossible to make high on $$anonymous$$us. I don't see height for where player is. Exactly, my player is there where you can see camera mark on the screenshot and it's always in the middle. And if I see this radius in half under the ground on the scene view then if I start play everything goes up (on?) the map and it's too high.
If you don't understand in 100% what I mean then:
screenshot before click play: https://zapodaj.net/aba6a519049de.png.html
screenshot after click play: https://zapodaj.net/0a94ae4c32c06.png.html
O$$anonymous$$ what happens if you add a capsule collider as a component to the character controller. Set Y to 1 and radius 1.5 and height to .5?
Thinking about it you should just be able to AddComponent a Sphere collider to the controller and then offset its position to be where your hands are.
Still, you can take a look, pay attention on the scene view where you can see collider and game view where it's get into this object :/
Year you're right. If you set your controller like this does it help.
Y = .5 Radius = 1
But is that better or worse or no different. Looks like more of your arms are outside the clipping plane of the object so try
Y = .75 Radius = 1.5
With this previous set up everything what I noticed is that, the player was a little bit higher than previously.
With it I noticed if Y is higher then my player is downer. Radius for take all hand with gun need to be set to 2. I chose Y set to 1.75 but now it's too big radius and I can't get too close to objects, for example:
https://zapodaj.net/3b3a35fdeca24.png.html
So how to set this to work, though, almost perfectly?
What I've been doing is setting Y to half the radius. It's not perfect and really you want to create your own controller so you don't get these issues but I guess that might be a while off.
Look on YouTube for tutorials on creating your own, it's hard at first but ultimately much easier as you have complete control over the script.
Your answer
Follow this Question
Related Questions
how to solve Box Collider corner problem ? 0 Answers
Getting the radius of a cylinder 1 Answer
Easier way to make large scale barriers? 0 Answers
Calling "OnTriggerEnter" when a parent object has a rigidbody 0 Answers
Collision problems 0 Answers