MoveObject & SetTimer in the same time -
NeXoR - 07.11.2016
Hey guys, I am working on a bombing system and I am having a little issue
Let's say I am launching a missile from my plane
I want the object to move from the plane to the ground (using ColAndreas to get the ground Z)
And once it reaches the ground, it will blow
Here is the code:
PHP код:
MoveDynamicObject(MissileObject[vehicleid], x, y, ground, floatround(GetVehicleDistanceFromPoint(vehicleid, x, y, ground)));
SetTimerEx("BlowMissile", floatround(GetVehicleDistanceFromPoint(vehicleid, x, y, ground)) * 1000, 0, "iifff", vehicleid, MissileObject[vehicleid], x, y, ground);
The object instantly moves to the ground, no delay, like the "time" parameter in moveobject doesn't matter
Anyone got a clue ?
Re: MoveObject & SetTimer in the same time -
NaS - 08.11.2016
The object travels to the ground pretty much instantly, because you set a veeery high speed (depends on the distance to the ground)...
The parameter in MoveObject is not time, it is speed. Thus, the distance to travel does not matter, since the bombs should probably move at a fixed speed.
Also why do you do it so complicated? There is a callback named "OnDynamicObjectMoved".
Using this, you can apply a static speed to an object and do not need to calculate anything, also no timer required.
Re: MoveObject & SetTimer in the same time -
NeXoR - 08.11.2016
Quote:
Originally Posted by NaS
The object travels to the ground pretty much instantly, because you set a veeery high speed (depends on the distance to the ground)...
The parameter in MoveObject is not time, it is speed. Thus, the distance to travel does not matter, since the bombs should probably move at a fixed speed.
Also why do you do it so complicated? There is a callback named "OnDynamicObjectMoved".
Using this, you can apply a static speed to an object and do not need to calculate anything, also no timer required.
|
First of all thanks for the DynamicObjectMoved, didn't know about it
But, I want that the speed will be dependent on the distance
For example 8 meters distance will be 5 speed
10 meters will be 5 + X and so on
Re: MoveObject & SetTimer in the same time -
Threshold - 08.11.2016
Well speed is measured in units per second... So how long do you want it for the object to take to move?
speed = distance / seconds
For example, if I want the object to move from one point to the other in 12 seconds, speed = distance / 12
Re: MoveObject & SetTimer in the same time -
NeXoR - 08.11.2016
Quote:
Originally Posted by Threshold
Well speed is measured in units per second... So how long do you want it for the object to take to move?
speed = distance / seconds
For example, if I want the object to move from one point to the other in 12 seconds, speed = distance / 12
|
Thank you very much