-Blaze- Posted February 10, 2016 Share Posted February 10, 2016 Hello, Is there a way to create an object having a projectile motion? eg. i make an object ( ID = 1369 ) is there a way to move this object in projectile motion? Link to comment
KariiiM Posted February 10, 2016 Share Posted February 10, 2016 Is there a way to create an object having a projectile motion? eg. i make an object ( ID = 1369 ) is there a way to move this object in projectile motion? I think that's possible Link to comment
KariiiM Posted February 10, 2016 Share Posted February 10, 2016 Explain what do you want from this object to do exactly Link to comment
-Blaze- Posted February 11, 2016 Author Share Posted February 11, 2016 Lets say i created an object local myobject = createObject ( 1369, x, y, z) i want to move this object in such a way , like the motion of a grenade when you throw it. it goes up for a while , then falls down , just like grenade. Link to comment
tosfera Posted February 11, 2016 Share Posted February 11, 2016 That'll require quite some math since there are no default functions for that. You would need some math about the force which is being used to throw the object, you need to calculate the angle, the speed and by taking the total distance you would be able to update the position from the object. It's seriously a pain in the ass so if you question was if there was a default function for that; no, I'm sorry. You can however let the user throw a nade and not make it explode + attach an object to it. Link to comment
-Blaze- Posted February 11, 2016 Author Share Posted February 11, 2016 @tosfera , that could work, i tried this code > function shootProjectile() local x, y, z = getElementPosition(localPlayer) local nade = createProjectile(localPlayer, 16, x, y, z) local myobject = createObject ( 1369, 0, 0, 0) attachElements( myobject, nade) end bindKey("mouse1", "down", shootProjectile) However , the object doesn't attach to the projectile , also there aren't any errors in debugscript. Also , how can i disable the explosion of the projectile? Link to comment
tosfera Posted February 12, 2016 Share Posted February 12, 2016 My bad, you're not able to attach an element to a projectile. You should save some data on the projectile and link that to an onClientRender and set the position of the object while taking it from the nade. Link to comment
-Blaze- Posted February 12, 2016 Author Share Posted February 12, 2016 i will try that , but how to disable the explosion of the projectile? Link to comment
tosfera Posted February 12, 2016 Share Posted February 12, 2016 use cancelEvent in combination with OnClientExplosion Link to comment
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