Quantcast
Channel: Questions in topic: "attach"
Viewing all articles
Browse latest Browse all 168

How to have an object attach to my player when collided

$
0
0
When my player walks into this object, in this case a cube, I need it to simply attach to the player as if they're carrying it. This is what I've done so far. var blockTransform : Transform; var playerTransform : Transform; function OnCollisionEnter (collision : Collision) { if(collision.transform.name == ("Player")) { blockTransform.transform.parent = playerTransform.transform; } }

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>