Author Topic: Increasing muzzle velocity greater then 1000?  (Read 5871 times)

The title says it all, is there a way I could (with out raycast) increase the max muzzle velocity or make my bullets fly faster?

The limit currently is actually 200. There is a sorta-hack that lets you create projectiles that go above the limit, however, clients cannot actually visually see the projectiles going that speed. Instead, they will see the projectile going at the speed limit (200) even though it's actually lagging behind its real position.

erm >.> and theres no way to actually make a projectile go faster then 200, visually/

erm >.> and theres no way to actually make a projectile go faster then 200, visually/
Exactly how much faster do you need it to go? At some point you're going fast enough to just scrap projectiles altogether and it's best to switch to raycasting instead.

1,000 units per second is 2,000 brick studs per second. For reference, a brick and half is about a foot IRL.

2,000 brick studs per second = 1,333 feet per second. 1,333 feet per second is 406 miles per hour.

If your projectile is going 406 miles per hour, use a loving raycast.

1,000 units per second is 2,000 brick studs per second. For reference, a brick and half is about a foot IRL.

2,000 brick studs per second = 1,333 feet per second. 1,333 feet per second is 406 miles per hour.

If your projectile is going 406 miles per hour, use a loving raycast.
thank you for laying out the numbers, I need a projectile to go 1000 minimum and 1600 maximum, to match the FPS or MPH of a per say real bullet, with out using raycasts because then I cant add bullet drop and particle trails look stupid, I want to simply know if this is possible, if so how would I could pull this off!

with out using raycasts because then I cant add bullet drop
Im afraid we need to use.... MATH.
but really though, I can't help you or much on the exact math, but basically you just get the distance between you and the bullets ending position, then reduce the z position by a function of the bullets distance, either a linear function if you want simplicity, or a parabolic function if you want realism
« Last Edit: July 25, 2014, 04:19:44 PM by Headcrab Zombie »

Im afraid we need to use.... MATH.
but really though, I can't help you or much on the exact math, but basically you just get the distance between you and the bullets ending position, then reduce the z position by a function of the bullets distance, either a linear function if you want simplicity, or a parabolic function if you want realism

NOICE! ill practice it and I know a perfect template to help me out!

Oh, and then fire another raycast to the new calculated position
There might even be a support resource available that does this

Im afraid we need to use.... MATH.
but really though, I can't help you or much on the exact math, but basically you just get the distance between you and the bullets ending position, then reduce the z position by a function of the bullets distance, either a linear function if you want simplicity, or a parabolic function if you want realism
What if the raycast hits something, where a curved bullet would go perfectly through a hole?

What if the raycast hits something, where a curved bullet would go perfectly through a hole?
Welcome back to the limitations of Torque.

The best work around I can think is to make a continuous series of short raycasts, each one aiming slightly lower than the last, to follow a parabolic curve. Fairly inefficient, obviously, so better ideas would be welcome.

Honestly, I haven't encountered any good dms with long enough range sniping to make bullet drop significant, so I'd just stick with giving bullets a random spread and not try to make super realistic bullet physics in Blockland

You could just do a second ray cast right next to the player at the point of impact but lower. No need to draw it all the way from the shooter to the target. Not perfect but probably the easiest to implement.

Back to the math. Gravity in Torque is 20 TQ Units / second squared.  Which means after one second, the bullet will have dropped by 10 bricks. However, 1000 units is far too long for any bullet to travel. For example, a gun bullet has a lifetime of 4 seconds and travels at 90 units per second. So it travels 360 units before it dies. A bullet at 1000 units per second would cover 360 units in 0.36 seconds. 0.36 seconds is a drop of 4 bricks. 4 bricks isn't even worth calculating bullet drop for, a player is about 4 bricks tall. But, if you really wanted to, you could subtract 4 bricks from the Z axis at the end point of the raycast (containerRayCast(%player.getMuzzlePosition(0), vectorSub(vectorAdd(%player.getMuzzlePosition(), vectorScale(%player.getMuzzleVector(), 360)), "0 0 4");) and the drop wouldn't be too far off from the actual drop.