So I am launching a part using part:ApplyImpulse( Vector 3 ) and I need the part to fling relative to its own x-axis. If I put in a value for x in the vector3 it will fling it in the direction of the world x-axis, but I want it to go in the direction of the parts own x-axis. I think it will involve using the parts own CFrame and maybe something like :ToWorldSpace() to get its own x-axis direction, or maybe lookvector. I am not very familiar with CFrame stuff, so if anyone’s knowledgeable that would be great.
part.CFrame = part.CFrame + Vector3.new(0,5,0)
Does this work?
part:ApplyImpulse(1000 * part.CFrame:VectorToWorldSpace(Vector3.new(1, 0, 0)))
Using XVector is probably the most efficient way:
part:ApplyImpulse(part.CFrame.XVector * impulseMultiplier)
Make impulseMultiplier negative if you want it to fly the other direction.
I will try this and get tell you if it works later
Well I need a vector3 value where the x is just the position next to the part, I’m not trying to just teleport the part to the side
Then you could multiply it by a Vector3 so it always go on the side
I’ll try this but it looks similar to things I’ve tried already
Well in the equation it looks like when you add the vector3, if I add an x value then it would go to the world’s side instead of the part’s side right?
Yeah it goes on the parts size but that side changes depending on the parts lookvector
so timesing it would be better
I will try this then and tell you if it works but I can’t do it today
Don’t post topics if your not even capable of testing the problem and the fixes given to you. I understand if your busy or if something is going on but then you can to post.
This worked for me, thank you!
this actually worked as well, thanks for helping. However, I also needed the part to be able to fly upwards which is why I chose the other post as the solution.
This didn’t end up working for me. I think it might have to do with the fact that it results in a CFrame value instead of a Vector3. Thanks for helping though
I understand, sorry about that.