0
\$\begingroup\$

I'm creating a grapple hook mechanic.

The elements of this particular situation are a Player and a grapple point.


I would like the top of the player to always be pointing towards this grapple point. (the up vector of the player is pointing along the vector to the point).

The default Unreal CharacterMovementComponent is in the falling movement mode right now, and the player's rotation around the Z axis is determined by the movement input. The X and Y rotations are unchanged.

Because the player's position around this grapple point could be anywhere on the sphere of influence of the rope, I never have a definite axis to rotate around to point the up vector towards the grapple point.


How do I achieve something like this?

\$\endgroup\$
  • \$\begingroup\$ Have you tried rotating the player? \$\endgroup\$ – TomTsagk Dec 3 '19 at 9:58
  • \$\begingroup\$ @TomTsagk I've only seen methods to rotate the forward vector of the player, not the upward vector. \$\endgroup\$ – Natalo77 Dec 3 '19 at 10:01
  • \$\begingroup\$ I'm unfamiliar with Unreal, but from a quick search I found the function AddActorLocalRotation which as an argument takes a quaternion, which could describe any type of rotation. Is it worth taking a look at it? Otherwise you might need share with us how you do rotations already, so its easier to suggest something closer to your level. \$\endgroup\$ – TomTsagk Dec 3 '19 at 10:05
  • \$\begingroup\$ @TomTsagk edited the question \$\endgroup\$ – Natalo77 Dec 3 '19 at 10:09
  • \$\begingroup\$ What do you want to rotate and around what axis ? \$\endgroup\$ – ColdSteel Dec 8 '19 at 10:10
1
\$\begingroup\$

"How to change the up vector of something in Unreal ?" The answer is simple - to change the upvector you simply need to change the object's rotation.

To make your upvector to point to something - you can use innate function of FMath especially take a look at: MakeRotFromXZ family of functions. docs

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.