How to rotate an object in the negetive trend?

Hay guys i’m new with BP scripting ,i wanted to try to make a game where the plane rotates left and right with different keyboard inputs but when i have used the Add Local Transform Node all it can add is positive rotation so i can’t rotate it on the left any ideas?



You have not written as should rotate your object. So I created an example in which the object is rotated to the right or left until the key is pressed.

Enable Input necessary for an object to respond to button presses.

Rotation is a speed of rotation.

You instead of using AddLocalTransform, if you just want to change the rotation, use AddLocalRotation (or relative suiting your need).
So you can make your object turn Pitch 0 Yaw 45 Roll 0 by pressing H and 0 -45 0 byt pressing G (let’s say ^^).
Also, if your actor is a pawn, maybe it’s better to use AddController Yaw Input.

And last advice, when dealing with multiple values pins (rotation, vector, transform, color…) you can split them by right clicking them and select “Split Pin Struct”.
That will give you float pins, except for the transform, as it contains Rot,Loc,Scale, you will have to split them again.
But it can be pretty usefull when it comes to use a function that use transform and you don’t need to specify it (or only one sub element).

For exemple, when you use Spawn Actor from class, it asks you the spawn transform, and if you dont do it you will get an error, so split it, and he will take the default values (0 for loc and rot, 1 for scale). It avoid creating a variable or putting a “Make Transform” that will add little mess to your graph ^^
But i’m going off subject so i’ll stop here ^^

Thank’s man so much. sorry but do you know like when you press a key and the ball will go forward with a for example 50 as you are still holding the key it’s still moving but after holding it for a while it will be fatser?

You mean the ball gets an acceleration instead of “dry” speed up ? or like a speed boost only after a certain time ?
For an acceleration, if your ball is physics enabled, you can try to do it that way:
Instead of adding rotation, you can add Torque. However it seems like torque is world based, so you’ll have to use a GetActorRotation to rotate the vector the force is applied. Like This:


For the Boost thing, you can do it several way.
Those methodes are just KeyHold methodes i made, i did it two way but i think there are other way (like the GetInput Key Time Down; but i’ve not played with it so far).
So first methode is using a gate. Like this

But if you want to do it a more modular way you can use timers.
If you connect array or enum to the function name, it allows you to change the target event/Functions you want to trigger, picking them from a list you made.

Thank’s a lot i will definitely try it out.

Sorry i have tried it out but it didn’t work in my case . here is my BP pls is theire a way to increase the speed of the ball as i’m still holding the Move X input button?


Does you ball roll at all ? is it working as intented except the acceleration ?
Try checking the “Accel Change” case. Also, i don’t know it you did it on purpose (if your game is a top down view i guess you did), but you forgot to rotate your vector. Currently the torque is applied in world coordinates. If your control are absolute, it’s fine, however if they are relative to your pawn, it may get tricky.

And i just realized you are using Axis Event. Make sure in your Input settings that the range is set to -1 ; 1 (or reverse). If that solve the problem, it’s only that your rotation have not the good axis range :slight_smile:

I’m a bit lost now, is your original issue with negative rot solved?

Yes my original issue is solved but what i couldn’t do is when the i play the game and play with the ball(it works fine) only it has a speed that can’t accelerate during time while i’m still holding the key Up(from my eventX tab) any way the problem is i can’t make the ball be faster in it’s movement,

Take a look at your Static Mesh in your BP, and under physics, find “Max Angular Velocity”, by default it is set to 400 and may be unsufficiant for wheels/balls etc. Try to increase the value to 1200 (or even higher but large value can have a negative impact)

Thank’s man that works very well thank’s a lot i really appreciate it.

Nice, you should mark the post as accepted answer so people having the same issue can see the solution.