Didn’t see a section for new users so posting here. Just downloaded v 2.6.1 a couple of days ago.
So I have a sphere that’s rolling/bouncing along a plane. Added a blob shadow as a child of the sphere. As the sphere rolls, of course, the shadow does as well. I assume I have to move the blob shadow out from beneath the sphere so it’s no longer a child and create a script on the blob shadow that keeps it’s XY position in sync with the sphere’s position?
Is there a simpler way?
Many thanks!
BTW, the tutorials are excellent. Is there a “How do I…” document or “cookbook” anywhere? TIA
I’m not sure what the ‘correct’ solution to this problem is, but something I’ve done in the past is to, in LateUpdate(), set the local rotation for the child object to the inverse of the parent’s rotation, e.g.:
I suspect I am doing as the OP and creating an empty object(lets call it Shadow), attaching a projector to it and then adding a script to it like so…
var ball : Transform;
function Update() {
transform.position = ball.position;
}
*notes… blob transform location is zero’d when a I set it as a child, with the rotation set to 90,180,0.
This works fine(if not efficient) when the gameObject isn’t parented, however as soon as I make it a child of a ball game object - it goes all kinky billy on me and the shadow rolls around again.
I tried Jessie’s suggestion - however it does not seem to have any effect.
I just tried it here and it worked perfectly. I added a child object to the sphere with the ‘cancel rotation’ code I posted earlier attached to it, and then added the blob shadow as a child object of that object, with a 90-degree X rotation to get the projector pointed along the Y axis. The end effect is that the ball rolls, but the shadow remains oriented correctly (that is, it’s always under the ball).
Anyway, post back if you need help setting this up.