x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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?alt text

Product Version: UE 4.8
Tags:
more ▼

asked Aug 29 '15 at 03:08 PM in Blueprint Scripting

avatar image

uehero
22 12 18 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi!

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.

alt text

rotate.png (375.6 kB)
more ▼

answered Aug 31 '15 at 11:39 AM

avatar image

svv3dUDN
8.4k 254 41 399

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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 ^^

more ▼

answered Aug 31 '15 at 02:09 PM

avatar image

Darknoodles
178 13 16 21

avatar image uehero Aug 31 '15 at 07:53 PM

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?

avatar image Darknoodles Sep 02 '15 at 12:06 PM

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:alt text

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 alt text 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. alt text

avatar image uehero Sep 02 '15 at 02:14 PM

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

avatar image uehero Sep 02 '15 at 03:09 PM

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? alt text

avatar image Darknoodles Sep 02 '15 at 06:24 PM

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 :)

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

avatar image uehero Sep 03 '15 at 12:15 PM

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,

avatar image Darknoodles Sep 03 '15 at 03:11 PM

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)

avatar image uehero Sep 03 '15 at 07:32 PM

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

avatar image Darknoodles Sep 04 '15 at 11:04 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question