- Home /
My character can stop movement of the Death Star!
Hi! Player has jedi's power in my game... but I dont want it. Problem I have described in my last question is still topical. But not totully. Let's take a situation: one rigidbody (its big spaceship) moves to my character (that has character controller), rigidbody is big and heavy, but my small character stops it! How to avoid that? Help please.
A Rigidbody cannot "push" a Character Controller by default. You will have to write your own way of making a rigidbody "push" a Character Controller.
"$$anonymous$$y character can stop movement of the Death Star!" - I just hate it when that happends. :o) $$anonymous$$y question is, where was your hero when they had the trouble in Star Wars?
Its just scandalous title, my game is set in my own universe, not in Star Wars. :)
Ok, thanks everyone, I solved the problem with changing Controller to a rigidbody. It's very helpful link: http://www.unifycommunity.com/wiki/index.php?title=RigidbodyFPSWalker And now we're going to organise messy battle inside falling Death Star! :}
Answer by Mahamed9628 · Dec 19, 2011 at 06:39 PM
Have you read my question? ok. Spaceship has rigidbody. My character has CharacterController. And why I should set isKinematic to true? My ship should be able to get influence of gravity, various forces etc. Mass of my shuttle is about 14000 kg. Also I tried to add that code to my character:
function OnControllerColliderHit(other:ControllerColliderHit){ if(other.rigidbody) cVec = other.rigidbody.velocity; } It really works and I can walk inside the ship, but I still can stop it.
You should reply to Answers via comment, not by adding a new answer. Anyway, in order to help you we need a visualization of what's going on. Otherwise we're just throwing guesses out. Show us some screenshots, specifically your rigidbody/collider settings on the two objects.
As suggested below, if your Player is stopping the ship, it could be that the Player is set to being $$anonymous$$inematic. If that doesn't do it, try removing your Player script entirely and see if the ship can run it over. If that doesn't do it, it's almost definitely a setting in either your ship or the player Rigidbody or Collider.
Ok, I'll make a video. But I can't understand: You don't read what I wrote? How can I set player to kinematic if it has CharacterController (not rigidbody)? I repeat you: Ship - rigidbody, player - characterController. But get back to business; it would be ok if player could stop ship anyway, but there is one exception. If I'm standing on the floor, ship could fly up! Its the same thing as standing near wall and trying to fly forward, but if I'm standing near wall and trying to fly forward, then ship STOPS. Attention: don't look at the graphics while watching the video, I didnt work with it. ;)
Surely for the character to be effected by gravity you have to have both a rigidbody and the CharacterController attached to the player, so you should have a rigidbody on your character, so if you dont at the moment add one and change the masses of the rigidbodies etc
Rigidbody and character controller at the same object? o_O Sorry, its new for me. I used to think that there should be only one. Ok, I'll try to make hybrid, but what about issues with hybridisation? For example, I use function $$anonymous$$ove() of the CC and character also gets affected by forces...Anyway, thanks for note :)
Answer by gregzo · Dec 18, 2011 at 07:54 PM
Have you attached a rigidbody component to the ship? Played around with masses? Last resort, on your ship's rigidbody, set isKinematic to true, it won't budge even if a planet hits it. Or maybe it's your character's rigidbody that is set to isKinematic?
Your answer
Follow this Question
Related Questions
Using rigidbody for collisions only, not movements? 1 Answer
Character Controller goes through objects 2 Answers
How to get transform.Translate to work with rigidbodies 2 Answers
How can I make a non-player character (rigidbody) move when they touch the ground? 1 Answer
How to hold objects in third person? 1 Answer