Search the Community
Showing results for tags 'axis alignment'.
-
Probably some easy question... but I've been struggling too long with the math. Does anybody know how to compute the Linear Velocity (world space) of a Circus Cannon Ball based on the Cannon Tube mesh orientation? In this case I use positive Y axis of cannon tube as 'forward', but in general I use the local Z axis as forward (to adhere to the definitions of BABYLON.Vector3.Forward() etc.). Once I know how to dynamically compute the (normalized) direction of the tube, I can then scale this vector with the cannon's shooting power (e.g. longer fire button press results in farther shooting). And add some random vector noise to make easy ball have a slightly different path each time. Please note that the tube is a child mesh on purpose so the orientation needs to be translated to world first. Here's the playground so far: http://playground.babylonjs.com/#R8ZH46 The solution to this question will probably be useful for anyone else who is creating some kind of ballistic shooter game (not first person). I noticed that all physics vectors are in world space only so therefore I am looking for these kind of transformations to roll up local mesh orientation to world physics direction. Thanks Q P.S. The cannon is set to auto-fire but you can use SPACE for fire as well, and [ and ] to turn the cannon.
- 6 replies
-
- transformation
- axis alignment
-
(and 4 more)
Tagged with: