- Home /
Draw an object at a position on a character, and for it to remain there wherever they go...
Hi all,
What I need to to do be able to draw a cube in the characters hands when i intersect it; but without making it a child object. I had this working a little while ago by making the cube an object of the hand on the character when you intersected it. But the problem is, is that i needed a box collider on the cube; so when i did that the charcter controller and the box collider where hitting each other and making my character jitter and jump.
So what I need to know is if there is a way in code to set the position of an object to the characters hand for example, and for it to remain there no matter where I go. So for example I hit the cube, it is drawn at my hand....and then if i move it stays at the hands position. But without making it a child object.....hope this makes sense.
Thanks!
Answer by robertbu · Jul 16, 2013 at 04:38 PM
If the box has a Rigidbody, you can use a FixedJoint to connect them. If you game does not depend on the box having an active collider when held, you can turn the collider off when the box is in the hands. If the character is a Rigidbody (not a character controller) you can use Physics.IgnoreCollision() to have the colliders of the box and the character ignore each other.
Also, more info on fixed joint: http://docs.unity3d.com/Documentation/Components/class-FixedJoint.html
Hi, Thanks for the reply this method also worked along side the method i have used. What it was is that i had not set istrigger = true on the cube which was in the players hand. This was causing a jittery motion....thanks for the reply!
Your answer
Follow this Question
Related Questions
Skined Cloth 0 Answers
Two Basic Physic Questions (Gravity and Jumping) 1 Answer
Make the character move a certain direction on collision 2 Answers
How to get a Character to move with a moving platform ? 6 Answers
Prevent a specific RB to influence another, but still collide with everything 0 Answers