Need help with BP math.


Line trace is not firing at right direction, it must simply go by arrow direction, does not do that. And also gravity and rotation is simply must set by line trace hit point’s normal, does not do that either.

Camera must always look at the charcater as character is directly facing above, line trace must fire from arrow, to arrow’s direction, by main trace distance variables distance. The character must rotate as the line trace hit points normal, and the gravity must be moddified as its opposite.

This is the current nodeset:

@ClockworkOcean @Mind-Brain

:slight_smile:

Plus ( please see previous examples… :slight_smile: )

1 Like

Still not really working. You see I attached impact normal to rotation, it must rotate the character directly the surfaces normal, if there is 2 straight surfaces one below and one above character, than the rotation must be 180 degrees, this is what supposed to happen, but it’s doing 90 degree turns, one right and one left.

@ClockworkOcean in the unreal template project, character automaticly turns towards gravity direction, how can I achieve that in my chacter?

In the template project I did not had to do anything to rotate the character, just the gravity.

try this

1 Like

I don’t understand why we have to multiply impact normal with 2. This does not require with gravity. By the way, as I asked to Clockwork Ocean there, is there a way to rotate the character automaticly by the gravity direction, just like the characters in Unreal templates? That would make my work much simpler.

There’s no way to rotate the character automatically; they probably do this in the C++ class (note: HuskyCMC is the character movement component)

when using ACharacterMovement it is the default behavior to adjust the Characters UpVector to be -GravityVector,there are subtle issues with it being too aggressive in snapping, especially in dramatic swings of the GravityVector, when you set the GravityVector it instantly reorients the characters UpVector.

  • if you do not want instant snapping to the new gravity direction then you need to manually Lerp the rotation of the gravity vector (convert the current GravityVector to a Rotation, then get the target GravityVector [normalize if it isn’t] to a Rotation, then Lerp from current-to-target, then convert the resultant rotation to a vector, and feed it into the GravityVector)

the Character’s GravityVector is technically exposed to blueprints as UE5.4 (you have access to the Get() and Set() but these are not the full functions)

1 Like

Thanks for the detailed answer. But can you simply tell how can I achieve that, as seems it is not currently the case in my character. Tho, when I set up the mechanics in templates it was just like that yes. I am such a newbie yet :slight_smile:

Actually in what I have imagined the normal behaviour which will be snap the rotation by the gravity would work, which I haven’t even managed to achieve, but setting gravity rapidly and then slowly adapting character rotation could look cool. For now first one will suffice to, can you help me set it up?

are you looking for the camera Rotation to be independent of the character’s orientation (for example the character is on the “right wall” but the camera is still with respect to Gravity=-Z ?

or

are you wanting the camera to reorient with the player (this can produce a few issues when the character is “upside down” because by default the camera wants to constrain Pitch to about [-120, 120])

1 Like

I didn’t understand the problem with “pitch” but yes I want the camera to be completely depended to character, and rotate and move with it as it does. However it better move smoothly than rapidly if that matters.