- Home /
Attach an object to another that is an animation
I am trying to get a player to jump onto a rope and swing, the rope has an animation so it is constantly swinging, both objects have kinematic rigid body, I am able to get the collision to work, however upon collision the player equals the ropes location but after a split second he drops from rope and is not connected. Any suggestions?
Answer by BLarentis · Aug 23, 2012 at 07:37 PM
Hello, you might need to disable the player gravity. Also you can try to make the player, child of the rope. Something like this:
player.transform.parent = rope.transform;
Take care!
Answer by Seizure · Aug 23, 2012 at 09:31 PM
Thank you for your response! I tried it, and it sort of worked, the problem is that the animation is always running and the player constantly swings like the rope. Another issue that may be a part of the problem is this is first person and there is no actual player object I am just moving the main camera.
// If player collides with rope; get collision objects id and attach to rope
var colliderObject : GameObject;
colliderObject = Collision.GameObject;
function Update () {
if (Collision.Gameobject == true){ colliderObject.Transform = GameObject.Transform;
} }
This is the current code I have for it. Also, I do not have gravity on either the rope or the camera. Any more suggestions are very welcome thanks!
You can try change the parent that you are setting to the camera. For instance, I believe that your rope object have several bones, try to set the bone more close to the point to be the camera parent. Take care!