Search the Community
Showing results for tags 'linearvelocity'.
-
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:
-
Hello all, I just started experimenting with the great Babylon framework. I am trying to mimic pallets (1.2 * 1.6 * 0.8 m, 1000 kg) running on a conveyor belt behaviour by setting a linearVelocity to an object without mass which then acts as the conveyor. See this demo: http://www.babylonjs-playground.com/#11KWUR#7 But i am running into a problem, related to the velocity. I am setting a velocity of 0.25 m/s (line 53) and the "conveyor" is 10 meters long (line 46). This means it should take about 40 seconds to cover that distance. But as you can see from the demo the speed is approximatly 1 m/s since it only takes 10 seconds to cover the distance. The issue is not related to friction, to illustrate I have added an other 'pallet' with low friction. Can somebody explain the behaviour to me? And how can I fix this? Thanks in advance!