HELP: get position after rotate an entity
Posted: Fri Aug 07, 2015 8:22 pm
Hi everyone,
I have this:

(The evil Euler angles strike back
)
A cylinder, use as a cannon barrel, on the top of it (initial position), there is a sphere, just put at cylinder.Position.Y + Sphere.radius (= A) and a weldjoint between them.
Rotating the barrel up/down before firing the first sphere is ok (entity move with it and go away when joint is inactivated + impulse applied).
My issue is how do I get the right location of a second sphere to put it on the same spot (B) with rotated barrel (let say angle alpha like on pic) ?
I'm a bit lost between XNA stuff to do the job (according to what I've seen so far, using quaternion and/or using Vector3.Transform method would do the job) and BEPU, which doesn't have the same methods (I guess another way has been chosen in BEPUutilities class). I don't know how to use Barrel.OrientationMatrix in this case.
The initial impulse use in fact thruster code from the demo and it's work just fine: linear impulse is on the expected direction. But I don't know how to do it for spawning a new sphere in the right location, knowing there are in fact two angles (on Z and on Y, as cannon has two degree of freedom), I guess doing the job with one is almost the same on the other.
Any help would be greatly appreciated, and please note I'm not asking for a ready-to-use answer, I would like even more to get just good clues and some exercises to do myself and try to reach the solution.
Thanks.
I have this:

(The evil Euler angles strike back

A cylinder, use as a cannon barrel, on the top of it (initial position), there is a sphere, just put at cylinder.Position.Y + Sphere.radius (= A) and a weldjoint between them.
Rotating the barrel up/down before firing the first sphere is ok (entity move with it and go away when joint is inactivated + impulse applied).
My issue is how do I get the right location of a second sphere to put it on the same spot (B) with rotated barrel (let say angle alpha like on pic) ?
I'm a bit lost between XNA stuff to do the job (according to what I've seen so far, using quaternion and/or using Vector3.Transform method would do the job) and BEPU, which doesn't have the same methods (I guess another way has been chosen in BEPUutilities class). I don't know how to use Barrel.OrientationMatrix in this case.
The initial impulse use in fact thruster code from the demo and it's work just fine: linear impulse is on the expected direction. But I don't know how to do it for spawning a new sphere in the right location, knowing there are in fact two angles (on Z and on Y, as cannon has two degree of freedom), I guess doing the job with one is almost the same on the other.
Any help would be greatly appreciated, and please note I'm not asking for a ready-to-use answer, I would like even more to get just good clues and some exercises to do myself and try to reach the solution.
Thanks.