Alright I am attempting to use this for something I am making where a single rigidbody bouncy ball splits into 3 or as many as I want other bouncy balls, and it is easy to simply instantiate an amount of them however they simply start bouncing up and down boaringly, I am trying to use this to give each ball the velocity and such of the ball they are technically separating from but for some reason I get this error. InvalidCastException: Cannot cast from source type to destination type. Separate+Start$20+$.MoveNext () (at Assets\WeaponScripts\Separate.js:20) I am not to experienced with javascript so I was wondering if anyone could point me towards the reason why this is happening or a fix to my problem, cheers.
(comments are locked)
|
|
recommand more better fucntion rigidbody.AddForce(velocity, ForceMode.VelocityChange); rigidbody.AddTorque(angularVelocity, ForceMode.VelocityChange); This isn't needed. There's a reason the velocity and angularVelocity properties are read/write. Original code fine.
Jan 20 '11 at 12:49 AM
Jonathan Czeck
(comments are locked)
|
|
Probably your bouncyExplosive prefab does not have a Rigidbody component attached to it, so when you cast it to Rigidbody and assign to variable eplosive1, it spits out that error.
(comments are locked)
|

Top of your code sample was clipped off in the format, don't forget checking the post previewer when posting , yes I'm nitpicky , but it helps with the Q&A process