[C#] Changing rotation of a prop after attached to ped?
-
Does anyone now how to change the rotation of a prop that is a attached to a ped so I can get it rotated correctly for a mod.
Any help? @stillhere @aimless @LeeC2202 @HeySlickThatsMe @Akila_Reigns @FoxtrotDelta @MAFINS @Frazzlee @DarthPungz
I need an answer ASAP for a mod
-
You can just re-attach the prop using the desired rotation and it should work!
Edit: you don't even need to detach the prop (in my experience). Simple use prop.AttachTo again.
-
@stillhere Could you possibly send a line of code? I am doing propName.AttachTo(Ped, boneIndex, vPos, vRot);
So then you're saying if I undo the attachment set the rotation then reattach it, it should work?
-
No need to undo the attachment! For example in my Shield Throw mod, while testing, I had this line of code:
weapProp.AttachTo(Game.Player.Character, 0, Vector3.Zero, new Vector3(rotateX, rotateY, rotateZ));rotateX, rotateY, and rotateZ were global float variables. I set it up so that using the arrow keys, I can increase/decrease them. I displayed the values as a subtitle so that I can take note of them when I find the rotation I like. When you call that line again after changing the variables, they will attach to the player using the new rotation values. In fact, you can even call "weapProp.AttachTo....." continuously in your OnTick and the prop will rotate in real-time.
-
@stillhere Oh I see now
-
@stillhere said in [C#] Changing rotation of a prop after attached to ped?:
weapProp.AttachTo(Game.Player.Character, 0, Vector3.Zero, new Vector3(rotateX, rotateY, rotateZ));
I JUST TRIED IT THANKS YOU, YOU ARE A GENIUS. I AM GOING TO PRAISE YOU IN THE README AND DESCRIPTION! I COULDN'T THANK YOU ENOUGH!!!!!!!!!!!!!!!!!!!
-
You're welcome, bro!
-
@Frazzlee lol I even get confused sometimes aswell