Ethernet Posted October 21, 2019 Posted October 21, 2019 (edited) Hello. I trying to make 3D throw for my bullet script. On X and Y axis is okay, but idk how to calculate Z axis. This script should work like this: But works like this: My code: x = x - math.sin ( math.rad ( rotationZ ) ) * 0.1 y = y + math.cos ( math.rad ( rotationZ ) ) * 0.1 --x1 = x- math.sin ( math.rad ( rotationZ ) ) * 4 --y1 = y + math.cos ( math.rad ( rotationZ ) ) * 4 z = ? What calculations I must use on Z axis? Thanks! Edited October 21, 2019 by Ethernet
XaskeL Posted October 21, 2019 Posted October 21, 2019 http://fizmat.by/kursy/kinematika/parabolicheskoe sorry, only in Russian 1
Ethernet Posted October 22, 2019 Author Posted October 22, 2019 Thank you, but it's not solved my problem. Maybe other solutions?
XaskeL Posted October 22, 2019 Posted October 22, 2019 2 hours ago, Ethernet said: Спасибо, но это не решило мою проблему. Может быть, другие решения?
Discord Moderators Zango Posted October 23, 2019 Discord Moderators Posted October 23, 2019 You need more than just rotationZ to do that, if you want to find a point from the rotation of the gun. Assuming your weapon has a pitch and yaw, and roll is 0, you would do this to find your point, where yaw is your rotationZ (in radians) x = x + 0.1 * math.cos(pitch) * math.cos(yaw) y = y + 0.1 * math.cos(pitch) * math.sin(yaw) z = z + 0.1 * math.sin(pitch)
Ethernet Posted October 25, 2019 Author Posted October 25, 2019 Okay, thanks Zango, but what's pitch? On 23/10/2019 at 20:33, Zango said: You need more than just rotationZ to do that, if you want to find a point from the rotation of the gun. Assuming your weapon has a pitch and yaw, and roll is 0, you would do this to find your point, where yaw is your rotationZ (in radians) x = x + 0.1 * math.cos(pitch) * math.cos(yaw) y = y + 0.1 * math.cos(pitch) * math.sin(yaw) z = z + 0.1 * math.sin(pitch)
Discord Moderators Zango Posted October 25, 2019 Discord Moderators Posted October 25, 2019 It's the angle your gun is tilted upwards in your picture. Like this rx, ry, rz = getElementRotation(gun) rx = math.rad(rx) rz = math.rad(rz) x = x + 0.1 * math.cos(rx) * math.cos(rz) y = y + 0.1 * math.cos(rx) * math.sin(rz) z = z + 0.1 * math.sin(rx) What is your gun, is it an object or a custom weapon? It might be better for you to use a matrix, see the example in getElementMatrix 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now