madis Posted April 10, 2011 Share Posted April 10, 2011 (edited) Hi, I'm trying to do a 'ish rope for fun. I'm a bit stuck on having a quality method to move the player on the rope.I got somewhat OK result by changing Element position with interpolateBetween. However, it might be nicer to use setElementVelocity, because it would allow to let go from the rope and still have some velocity left (you can see usefulness of that in the Liero video). Also it would solve the problem of going through objects. The problem is, that setElementVelocity seems to throw the player in quite random position. local a,b,c = getElementPosition(localPlayer) x_target, y_target, z_target = unpack(g_Rope.targetPos) -- This one actually works, got it from someone else's script wanted_ped_angle = (360-math.deg(math.atan2(( x_end-a ),( y_end-b ))))%360; setPedRotation(localPlayer, wanted_ped_angle); -- These don't seem to affect the velocity behaviour, so commented out: --setPedLookAt(localPlayer ,x_end, y_end, z_end, 0) --setPedAimTarget(localPlayer ,x_end, y_end, z_end) -- There seems to be a problem moving the player when on ground, so let's give a lift if isPedOnGround then setElementPosition(localPlayer, a,b,c+1, false) end setElementVelocity(localPlayer, 0.2, 0, 0) It does move the player if I'm not on the ground, but it seems to move the player in random position. Should I change the parameters in setElementVelocity? Are there anything more than speed in these actually? Edited April 11, 2011 by Guest Link to comment
Moderators Citizen Posted April 10, 2011 Moderators Share Posted April 10, 2011 The problem is, that setElementVelocity seems to throw the player in quite random position. No but just in the X axis of the GTA world ( it's not Z instead ??? ) and you want the player's axis right ? and I seen an error ( fixed here ): if isPedOnGround( localPlayer ) then setElementPosition(localPlayer, a,b,c+1, false) end Link to comment
madis Posted April 10, 2011 Author Share Posted April 10, 2011 (edited) It should be all of these, I guess. If the rope has been shot just in front of you, there's no z though. Even if I don't set Y velocity, it should still move in the right direction on one axis, imo. But while testing I got the opposite direction quite often. Edited April 11, 2011 by Guest Link to comment
Antibird Posted April 10, 2011 Share Posted April 10, 2011 X always goes south to north, Y west to east, Z from earth depths to the outer space. Setting the same velocity again and again must give the same results no doubt. Link to comment
madis Posted April 10, 2011 Author Share Posted April 10, 2011 Oh! Thanks for the explanation. Too bad it wasn't stated in the wiki. 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