Here’s what I currently do. ‘p’ is the parent and bodyhit is the rigidbody.
It would seem though that depending on my point of contact I’m not doing it correctly.
Hope my rather bad question is clear - any help/suggestions appreciated
I am new to Unity, too, but I think the easiest way to do something lake that would be to parent your object to an empty and move that one forward, while rotating the child. At least that’s how I’d do an animation like that in Max, but I guess it should work in Unity, too.
Thanks for the info.
I can’t use the camera ‘forward’ as the camera is all over the place
I guess another way to phrase it is:
When my player collides with the cube. I wish the cube’s forward to be perpendicular to it but facing in the same direction as the cooling player. Erm, not sure if that helps :-))
I’ll explain what I want in real terms :-)))
I have a cube, I wish it to move in the direction that’s appropriate based on which side receives the collision. So hit the south face it should move north, hit the east face it should move west. My colliding body can obviously hit any of the 4 faces at any angle, equally the cube’s ‘forward’ could be anywhere i.e. the cube could be rotated around the y (up) axis.
So I am trying to create a new ‘forward’ vector so that I can move the cube in the appropriate direction.
Forgive my lack of knowledge and confusion; does this help?
No problem, but please first of all, comments are comments and answers are answers. You should not use the answer form, if you want to just leave a comment
Secondly, a vector A is perpendicular to vector B if their crossproduct is zero (90 degrees angle). A vector facing the opposite direction is simply called the inverse vector.
I guess you want to create some kind of bouncing behaviour?
Ideally you actually want to use the physics engine to get realistic behaviour of collisions. But if not you can use a simplified formula like:
Vector3 direction = (transform.position - collision.hitpoint).normalized;