|
I have a mesh that has a box collider and a rigidbody. I use a mouse to move that mesh. I also rotate that mesh with the mouse wheel. Script looks something like this now: When I put a sphere with rigidbody to fall on top of the mesh, I can move the mouse so fast the sphere goes right through the mesh. The other problem is the mouse controlled mesh can go through walls with colliders. I can't use Character Controller because it apparently comes with its own collision sphere.
(comments are locked)
|
|
Using Translate and Rotate will put things where you say, they won't care about collision. You either need to implement OnCollisionEnter on those objects and have them inform this script to stop, or probably better, use the RigidBody functions MovePosition and MoveRotation Do I still have to use some kind of collision detection to stop the mesh from moving when I'm using Rigidbody's MovePosition? Because replacing Translate with those didn't help. It still can get other rigidbodies to move when touching, but it itself won't stop when hitting a wall. The other problem was with mouse sensitivity. Because if I want to use that, the mouse can move so fast, it just passes the other rigidbody meshes.
Mar 27 '12 at 05:46 AM
laskiapina2
Try implementing OnCollisionEnter and have it access your 'move' script or SendMessage to tell it to stop moving.
Mar 27 '12 at 07:00 PM
DaveA
I have tried to get this to work but there's no hope. I use: function OnCollisionEnter(collision : Collision) { if (collision.rigidbody) {} else { osuuSeinaan = true; } and if osuuSeinaan is false, I try to rigidoby.moveposition, but can't get the Input.GetAxis("Mouse X") to that command. When there's no variables but numbers in rigidbody.moveposition, it still goes through the wall.
Mar 28 '12 at 06:00 AM
laskiapina2
(comments are locked)
|
