Jump to content

Object with projectile motion


-Blaze-

Recommended Posts

Posted

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?

Posted

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

Posted

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.

Posted

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.

Posted

@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?

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...