- Home /
Seek behavior has object following its target but doesnt point towards it, how do i make the object to point at the vector but without ruining its velocity?
The code is fine and it follows the target properly. If i add transform.lookat(velocity) then the path becomes different and quite frankly ugly.
If its still not clear then please tell me to rephrase this.
Thanks
I never did that but maybe you should just separate your object like the rigidbody as parent and the mesh child to it so you can orient the mesh without doing changes to the rigidbody.
@barbe63's comment is definitely the way I would tackle this problem. Seperation of the rigidbody and model is my default way of building my GameObjects.
However I thought I would provide an alternative:
You could always get the velocity, rotate the object and then recalculate the velocity based on the new rotation. This way requires a bit more math but allows you to keep the model/rigidboy as one object.
@barbe63, that was it! Thing is, i thought i had already done that but the hierarchy was all messed up. so i re-did the whole thing and it works flawlessly! cheers mate! Also @RoguelikeShadow, is that wise or do i keep it them seperated? i would do the better thing is which i think is to keep them seperated.
Like I said I prefer @barbe63's method. It has the added benefits of being able to scale/rotate the mesh without affecting your rigidbody.
I was just providing an alternative in case you had designed your entire project around the single object logic and it was too late to go back.
But since it seems you haven't, definitely go with the separated objects
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Is this making my AI move? 0 Answers
Making a bubble level (not a game but work tool) 1 Answer
An OS design issue: File types associated with their appropriate programs 1 Answer