Page MenuHomeFeedback Tracker

Local vehicles and getting object "velocity"
Feedback, NormalPublic

Description

When vehicle is created locally using createVehicleLocal, after few seconds, the object constantly returns velocity of [0,0,0].
velocityModelSpace however returns normal output.

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Load into game with debug console enabled,
run following code globally or locally for singleplayer:

BALLTest = {
    if (isNil "ABCDEF" || {isNull ABCDEF}) then
    {
        ABCDEF = "Land_Football_01_F" createvehicleLocal ((getPosASL (allPlayers # 0)) vectorAdd [0,0,3]);
        if (hasInterface) then
        {
            diag_log "Client creating ball";
        } else {
            ["Server creating ball"] remoteExec ["diag_log", -2];
        };
    };

    ABCDEF setVelocity [0,0,100];
    if (hasInterface) then
    {
        diag_log format ["Client applied velocity %1", velocity ABCDEF];
    } else {
        [format ["Server applied velocity %1", velocity ABCDEF]] remoteExec ["diag_log", -2];
    };


    [ABCDEF] spawn {
        params[["_ball", objNull]];
        if (isNil "_ball" || {isNull _ball}) exitWith
        {
            if (hasInterface) then
            {
                diag_log format ["Client ball nil/Null? %1 %1", isNil "_ball", {isNull _ball}];
            } else {
                [format ["Server ball nil/Null? %1 %1", isNil "_ball", {isNull _ball}]] remoteExec ["diag_log", -2];
            };
        };
        sleep 0.5;
        if (hasInterface) then
        {
            diag_log format ["Client velocity %1", velocity _ball];
			diag_log format ["Client velocityModelSpace %1", velocityModelSpace _ball];
        } else {
            [format ["Server velocity %1", velocity _ball]] remoteExec ["diag_log", -2];
			[format ["Server velocityModelSpace %1", velocityModelSpace _ball]] remoteExec ["diag_log", -2];
        };
    };
};

call BALLTest;
[] spawn {
    sleep 10;
    call BALLTest;
};

Observe log output (DS example):

18:18:57 "Client creating ball"
18:18:57 "Client applied velocity [0,0,100]"
18:18:57 "Server creating ball"
18:18:57 "Server applied velocity [0,0,100]"
18:18:57 "Client velocity [0,0,95.0184]"
18:18:57 "Client velocityModelSpace [-7.57735,-3.0196,94.6677]"
18:18:58 "Server velocity [0,0,94.9368]"
18:18:58 "Server velocityModelSpace [-7.57083,-3.017,94.5863]"
18:19:07 "Client applied velocity [0,0,100]"
18:19:07 "Server applied velocity [0,0,100]"
18:19:08 "Client velocity [0,0,0]"
18:19:08 "Client velocityModelSpace [-7.57735,-3.0196,94.6677]"
18:19:08 "Server velocity [0,0,0]"
18:19:08 "Server velocityModelSpace [-7.57735,-3.0196,94.6677]"
Additional Information

When velocity is applied using setVelocity, object visually moves.

Tested on DS, Listen server and singleplayer.

Event Timeline

Markoo created this task.Oct 20 2024, 6:27 PM
Leopard20 added a subscriber: Leopard20.EditedOct 20 2024, 7:14 PM

Looks like this is a bug in the simulation of "ThingX". The object is "stopped" after 5 seconds, because the game forgets to mark it as "moved". (it keeps getting moved and immediately stopped in the same frame...)
A simpler example:

ABCDEF = "Land_Football_01_F" createvehicle getPosATL player;
ABCDEF setVelocity [0,0,100];
TimeCreated = time;
TimeStopped = nil;
onEachFrame
{
	systemChat str [velocity ABCDEF#2, velocityModelSpace ABCDEF#2];
	if (velocity ABCDEF#2 == 0) then
	{
		if (isNil "TimeStopped") then {TimeStopped = time};
		systemChat str (TimeStopped-TimeCreated);
	};
}

14:25:57 "Client applied velocity [0,0,100]"
14:25:57 "Server applied velocity [0,0,100]"
14:25:57 "Client velocity [0,0,94.8551]"
14:25:57 "Client velocityModelSpace [-54.7455,-54.7723,54.776]"
14:25:57 "Server velocity [0,0,94.8551]"
14:25:57 "Server velocityModelSpace [-54.63,-54.6486,55.0144]"
14:26:06 "Client applied velocity [0,0,100]"
14:26:07 "Server applied velocity [0,0,99.9183]"
14:26:07 "Client velocity [0,0,95.0184]"
14:26:07 "Client velocityModelSpace [-54.8397,-54.8667,54.8703]"
14:26:07 "Server velocity [0,0,94.9368]"
14:26:07 "Server velocityModelSpace [-54.583,-54.6015,54.967]"

good?

Revision: 152303

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Oct 22 2024, 4:00 PM
BIS_fnc_KK changed the task status from New to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.