|
I have an object which destroys itself then creates a new object at the same time and it works fine. The rotation and everything is all the same but the velocity resets which doesn't really make it seem that seamless. So is there a way i can get the instantiated object to continue with its parent's velocity?
(comments are locked)
|
|
You can set the object's velocity immediately after instantiating it. In general, you shouldn't use the ability to set velocity directly as a method of controlling or moving the object (you should apply forces instead), but in this situation where you are setting its initial velocity after creating it, it should be fine:
You might also find that you need to set up an IgnoreCollision between the old and new objects - if they both have colliders, there's a chance a physics update may occur while they both exist in the same position. Worked brilliantly thanks. :D
Feb 14 '10 at 02:08 PM
Evil Tebor
You're welcome - please upvote the answer and click the 'accept' tick to indicate the question has been answered :) Duck 1 min ago
Feb 14 '10 at 04:19 PM
duck ♦♦
I have a question. In my case, I have a non-rigidbody weapon object as a child of my rigidbody player, and my rockets spawn from the weapon. So your solution does not work in its current form. How do I find the velocity of the root object in a hierarchy?
Sep 27 '12 at 08:07 AM
Dubious Drewski
simply have a variable, boss, that points to the rigidbody just set it in the editor (ie, drag it) { if you don't want to set it in the editor, just use ".parent" to find it in code. if (for some reason) you truly want to generally find the highest object, search on here for 1000s of questions about that, or ask a new separate question } then use boss.velocity
Sep 27 '12 at 08:14 AM
Fattie
(comments are locked)
|
