Faw[Ful] Posted June 11, 2011 Share Posted June 11, 2011 It is possible to move an Element like this ? Link to comment
h1ama3d Posted June 11, 2011 Share Posted June 11, 2011 you mean this ? setElementVelocity ( getPedOccupiedVehicle( player ), 0, 0.1, 0.5) Link to comment
UAEpro Posted June 11, 2011 Share Posted June 11, 2011 (edited) أحلى حمودي يساعد ض1 ----- yes .. using jump script and lets the gravity play when he reach the top point. i sow in many maps they got jump script ^^ like onClientMarkerHit local oldp function example() oldp = getElementPosition if oldp ~= oldp+10 then setElementPosition(element,oldp+1) example2() end end function example2() newp = getElementPosition if newp ~= oldp+10 then setElementPosition(element,newp+1) example2() end end this is simple jump script by me .. to know the idea .. you need to edit it so if the element was at x speed when he jump .. he will jump like parabola Edited June 11, 2011 by Guest Link to comment
Faw[Ful] Posted June 11, 2011 Author Share Posted June 11, 2011 ... Element can be an object , I can do this with a lot of standard object movement (script to move an object that follow a line), but there is another way ? Edit : Okay ! I want to make some particles with this and a particle follow an parabolic motion not a line. Link to comment
UAEpro Posted June 11, 2011 Share Posted June 11, 2011 (edited) see my edit and also as h1ama3d said .. you can give the element or object some Velocity Edited June 11, 2011 by Guest Link to comment
h1ama3d Posted June 11, 2011 Share Posted June 11, 2011 h1ama3d not hmody فضحتنا -_-" ...Element can be an object , I can do this with a lot of standard object movement (script to move an object that follow a line), but there is another way ? Edit : Okay ! I want to make some particles with this and a particle follow an parabolic motion not a line. see : https://wiki.multitheftauto.com/wiki/Cli ... _functions https://wiki.multitheftauto.com/wiki/AttachElements Link to comment
SDK Posted June 11, 2011 Share Posted June 11, 2011 I see three ways of doing that: 1) Like told above, create an object that can move, use attachElements on it, and shoot it away. Easy for large distances, but you need to rely on the moveable object. Like this resourcefor example: it uses the flowerpot vehicle to create airbombs 2) Use moveObject with some kind of easing type (maybe InBounce or OutBounce are what you need). Harder and you would need to find the correct type for it. 3) A math function and use setElementPosition in combination with a timer or onClientRender. You'll need to know some math for this ^^. Link to comment
karlis Posted June 12, 2011 Share Posted June 12, 2011 local theObj,time,sx,sy,fx,fy,a,b,c,ticks function handleMove() if ticks==0 then ticks=getTickCount() end local progress=(getTickCount()-ticks)/time if progress<1 then local cdist=((fx-sx)^2+(fy-sy)^2)^0.5 local cx,cy=sx+(fx-sx)*progress,sy+(fy-sy)*progress local h=a*(-cdist/2+cdist*progress)^2+b*(-cdist/2+cdist*progress)+c setElementPosition(theObj,cx,cy,h) else killHandler() end end function addParabolicMovement(theObj2,time2,sx2,sy2,fx2,fy2,a2,b2,c2) theObj,time,sx,sy,fx,fy,a,b,c,ticks=theObj2,time2,sx2,sy2,fx2,fy2,a2,b2,c2,0 addEventHandler("onClientRender",getRootElement(),handleMove) end function killHandler() removeEventHandler("onClientRender",getRootElement(),handleMove) end function addParabolicMovement(element obj, int time, float sx, float sy, float fx, float fy, float a, float b, float c) --[[ obj - no comments time - elapsing time, in ms sx,sy - starting pos fx,fy - end pos a,b,c - params for y=ax^2+bx+c function, c is base height aswell ]] note: if you want that obj ends up in same height as it started, make sure b is 0 EDIT:centered the func. 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