Help me Fix My VR Grenade system.

PLEASE help me solve this problem!
This single issue is preventing me from releasing this to the marketplace. I am trying to pull a grenade pin from the grenade with the secondary hand, And I have got it so close to what I want it to work like, But its only working correctly when the grenade is facing a POSITIVE X world location. I want the pin movement to be restricted like I have made it to a single Vector for removal. But not care what world rotation it has. I have tried to fix this but without luck. here is a video and a BP pic of the key area
Please tell me what I am doing wrong

@ 0:46 you can clearly see the grenade is only reading the hand movement in the positive world X vector.

You are getting the World location of the pin and of the second hand, then taking the X axis of the difference. This will work as intended only if the relative movemebt happens along the world X direction, but if you turn around 90 this won’t be the case anymore. What you want is to detect a relative movement along the granade X direction (or whatever direction the pin is sliding). For that you need to transform both the hand position and the pin position from world reference to local reference. Have a look at the Compose Transform node. It has examples about going to world space to local space and viceversa.

You need to project this vector (Hand_Location - Grenade_Pin_Location) to grenade’s local X axis.

Big thanks Thanks guys, I will let you know If I am successful, I will be very happy If If this works :slight_smile:

Tried a few things But Im not getting it yet. If anyone can post an example I would be grateful . Stupid thing is I already did this in the past on this same project to solve the clip flying off in the correct direction, Bottom pic!
But Im having a logic problem in my head this time :frowning:

OK think I might be closer. It works in any direction But I cant slowly slide the pin in and out , seems to just snap to the max clamp value atm

@AlphaWolF The direction vector to Inverse Transform should be the one given by the difference between the Secondary Hand world location and the Granade Pin world location. Not the X value, but the entire direction vector. Then you can take the X value out of the transform as it will be in local space.

:):):):):):):):cool:

This was it, HUGE THANKS ,