Search the Community
Showing results for tags 'vectorup'.
Found 1 result
-
GUI 3D Object Direction/Up Vectors (pls help)
NumbNutsJunior posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I am trying to make a 3D object point to a position in GUI. I have the object at `z = 0.25`, I assume that the other 2D controls would be at `z = 0.00`. I have tested in the eden editor with the following code, and it works perfectly fine... // ... private _screw_driver_pos = position screwdriver; private _can_pos = position can; // ... private _dir_vector = _screw_driver_pos vectorFromTo _can_pos; // ... private _random_direction = [random 100, random 100, random 100]; _random_direction = vectorNormalized _random_direction; // ... private _up_vector = _dir_vector vectorCrossProduct _random_direction; _up_vector = vectorNormalized _up_vector; // ... screwdriver setVectorDirAndUp [_dir_vector, _up_vector]; This is the result of that: This is the code when working with the gui controls... // DEBUG debug_control_01 ctrlSetPosition [_screw_driver_tip_position_x, _screw_driver_tip_position_y]; debug_control_01 ctrlCommit 0; // DEBUG debug_control_02 ctrlSetPosition [_screw_driver_position_x, _screw_driver_position_y]; debug_control_02 ctrlCommit 0; // Get the screwdriver's current position and desired tip position private _screw_driver_position = [_screw_driver_position_x, _screw_driver_position_z, _screw_driver_position_y]; private _screw_driver_tip_position = [_screw_driver_tip_position_x, _screw_driver_tip_position_z, _screw_driver_tip_position_y]; // Update the screwdriver's position _screw_driver_object ctrlSetPosition _screw_driver_position; // Calculate the screwdriver's direction based on the tip position private _screw_driver_dir = _screw_driver_position vectorFromTo _screw_driver_tip_position; // ... private _random_direction = [random 100, random 100, random 100]; _random_direction = vectorNormalized _random_direction; // ... private _screw_driver_up = _screw_driver_dir vectorCrossProduct _random_direction; _screw_driver_up = vectorNormalized _screw_driver_up; // Update the screwdriver's direction _screw_driver_object ctrlSetModelDirAndUp [_screw_driver_dir, _screw_driver_up]; This is the result of that: If you understand why this happens or what I need to do to fix this, please help. The screwdriver's tip is supposed to be pointing at the red dot in the lock @Dedmen @killzone_kid Added github branch for more context: https://github.com/NumbNutsJunior/Active-Lockpicking/blob/screwdriver/Lockpicking.VR/hud/functions/fn_hud_lockpick.sqf