Page MenuHomeFeedback Tracker

PhysX simulation type bug with modeltoworld commands etc
New, NormalPublic

Description

With a X enabled simulation (helicopterX in this case), commands that use model space (modeltoworld, worldtomodel, selectionposition) are affected by a velocity error, giving incorrect visual positions even though their world position reads the same.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Operating System Version
x64
Category
Game Physics
Steps To Reproduce
Additional Information

https://m.youtube.com/watch?v=NH-2uRq_VEg&rdm=261een6hl&client=mv-google
With a X enabled simulation (helicopterX in this case), commands that use model space (modeltoworld, worldtomodel, selectionposition) are affected by a velocity error, giving incorrect visual positions even though their world position reads the same.

Using an old simulation type (such as helicopter) results in proper function of model space commands, at the cost of properly functioning physics.

If an object is static, there are no problems and position looks correct. When it starts moving, model space loses synchronization with the visual model and presumably other LODs.

Event Timeline

have you tried modelToWorldVisual and worldToModelVisual instead?

No i haven't but Should i? It seems to be the same

I have tested it, error still occurs

I think this a bug and it cant be fixed by my own it requires bohemia team to fix it because its a game problem by physx introduced in arma 3

I doubt video alone without any repro helps in this case.

miguel93041 added a comment.EditedAug 25 2016, 6:46 PM

https://forums.bistudio.com/topic/160464-key-interactioncockpit-interaction-tutorial/

For example this is the script that im using and its failing cause of this bug.

The cockpit interactions move of position because the selectionpoints are moving too.. caused by the bug it self. I have tested both options in this script, with the memory lod points and without it, both bugged. And if you try modelToWorldVisual still fails.

//if the player isn't in a helicopter then we don't run this
if(vehicle player iskindof  "Helicopter") then
{
_heli = vehicle player;
if(isNil "button_clicked") then {button_clicked = 0;}; //keeps our key from constantly having an effect - that is, press it once and it won't do anything again until released and pressed again

_controlpos = _heli modelToWorld [0,2,0]; //our desired control point tailored for AH-9
_controlpos = worldtoscreen _controlpos; //convert the above to screen coordinates
if(count _controlpos < 2) then {_controlpos = [-100,-100];}; //if the point is outside of our FOV then set it to something ridiculous

_hinttext = "No Action"; //basic hint to indicate what we're looking at

//player sidechat format ["%1",_controlpos]; //debugging - shows position of a control on screen coordinates; the closer to 0.5,0.5, the closer it is to the center of the screen

if(_controlpos distance [0.5,0.5] < 0.4) then {_hinttext = "Toggle Engine";}; //change hint to engine on

if(!(_hinttext == "")) then {hintsilent format ["%1",_hinttext];}; //set our hint text

if(_hinttext == "No Action") exitwith {}; //if no action available then we don't need to do anything so quit

//check to see if our action is within the right parameters and that the key has been pressed, then do something
if(inputaction "User20" > 0.5 && button_clicked == 0 && _controlpos distance [0.5,0.5] < 0.4) then
{
	if(isengineon _heli) then
	{
		player action ["EngineOff", _heli];
	} else {
		player action ["EngineOn", _heli];
	};
button_clicked = 1;
};

//clear our key press if it's not being pressed
if(inputaction "User20" < 0.5) then
{
button_clicked = 0;
};
};

I am not sure how to use your repro, it seems out of context. However I have found this in the thread you linked:

myconepos = {
helippos = heli modeltoworld (heli selectionposition "rotor_center");
cone1 setpos helippos;
};
["myconeid", "onEachFrame", "myconepos"] call BIS_fnc_addStackedEventHandler;

This makes cone skip all over the place indeed. However

myconepos = {
helippos = heli modeltoworldvisual (heli selectionposition "rotor_center");
cone1 setpos helippos;
};
["myconeid", "onEachFrame", "myconepos"] call BIS_fnc_addStackedEventHandler;

makes it stay glued to the heli.

But if in the script you change it to these:

_controlpos = _heli modelToWorldVisual [0,2,0]; our desired control point tailored for AH-9
_controlpos = worldtoscreen _controlpos;
convert the above to screen coordinates

it dont stay glued to the heli, the desired point at 0,2,0 starts to move until the heli stops

miguel93041 added a comment.EditedAug 25 2016, 7:36 PM

Im gonna explain it again.

Just do the tutorial in that web it takes 10 minutes to complete it.
When you did that, start the helicopter´s engine and start to fly, you´ll see our desired point where the action is at the cockpit, its moved but if you stop the helicopter the action its again where it belongs.

And this video: https://m.youtube.com/watch?v=NH-2uRq_VEg&rdm=261een6hl&client=mv-google

Explains how the action is moved by the velocity that the heli takes, and its because of a physX simulation type bug.

First of all create a .sqf file on the mission folder called pfh_click.sqf and write this in:

//if the player isn't in a helicopter then we don't run this
if(vehicle player iskindof  "Helicopter") then
{
_heli = vehicle player;
if(isNil "button_clicked") then {button_clicked = 0;}; //keeps our key from constantly having an effect - that is, press it once and it won't do anything again until released and pressed again

_controlpos = _heli modelToWorld [0,2,0]; //our desired control point tailored for AH-9
_controlpos = worldtoscreen _controlpos; //convert the above to screen coordinates
if(count _controlpos < 2) then {_controlpos = [-100,-100];}; //if the point is outside of our FOV then set it to something ridiculous

_hinttext = "No Action"; //basic hint to indicate what we're looking at

//player sidechat format ["%1",_controlpos]; //debugging - shows position of a control on screen coordinates; the closer to 0.5,0.5, the closer it is to the center of the screen

if(_controlpos distance [0.5,0.5] < 0.4) then {_hinttext = "Toggle Engine";}; //change hint to engine on

if(!(_hinttext == "")) then {hintsilent format ["%1",_hinttext];}; //set our hint text

if(_hinttext == "No Action") exitwith {}; //if no action available then we don't need to do anything so quit

//check to see if our action is within the right parameters and that the key has been pressed, then do something
if(inputaction "User20" > 0.5 && button_clicked == 0 && _controlpos distance [0.5,0.5] < 0.4) then
{
	if(isengineon _heli) then
	{
		player action ["EngineOff", _heli];
	} else {
		player action ["EngineOn", _heli];
	};
button_clicked = 1;
};

//clear our key press if it's not being pressed
if(inputaction "User20" < 0.5) then
{
button_clicked = 0;
};
};

Then spawn an helicopter (AH-9) and start the mission.
After that open your debug console and type:

my_clickaction = compile preprocessFileLineNumbers "pfh_click.sqf";  ["my_clickid", "onEachFrame", "my_clickaction"] call BIS_fnc_addStackedEventHandler;

Well, I obviously cannot check what you are saying, as script you provided does nothing as it is.

Yes it does but you dont understand it..
It creates a point at (0,2,0) based on the modelToWorld position.
Then you asign an action like "Start engine" on that point.
When you start to fly that point move away.

miguel93041 renamed this task from PhysX bugs with modeltoworld commands etc to PhysX simulación type bug with modeltoworld commands etc.Aug 25 2016, 9:02 PM
miguel93041 updated the task description. (Show Details)
miguel93041 renamed this task from PhysX simulación type bug with modeltoworld commands etc to PhysX simulation type bug with modeltoworld commands etc.
llull23 added a subscriber: llull23.EditedAug 25 2016, 9:23 PM

I can reproduce it too