collision - Unity3d: Collider with an object and update its transform, then loses all rigidbody attributes and falls through objects -


 private void start() {     connected = false; }  private void oncollisionenter(collision collision) {     if (collision.transform.tag == "player")     {         droneplayer = collision;          offset = droneplayer.transform.position - gameobject.transform.position;          connected = true;     }    }  private void update() {     if (connected)     {         transform.position = droneplayer.transform.position - offset;     } } 

simply, want pick object object after collision , move around. script changes transform of object hit transform.

the problem here works k except when close object in scene. laws of rigidbody ignored , passes through other objects bump against.

its because you're forcing position @ specific spot relative object it's "stuck" to: no longer rigid body being controlled physics engine. object it's stuck has no idea can't move forward more, so, , causes interpenetration.

you need add object's collision volume controlling object's hierarchy physics engine does know it.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -