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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

how to work out specific rotation

I'm making a small mobile game around diving for a game jam. the game uses your phone gyro to tilt the character so you can spin him back and forth. I'm having a bit of a problem trying to work out how to count spins for flips and also work out when he is facing down so I can switch graphics to dive graphics

alt text

Product Version: UE 4.19
Tags:
untitled-2.jpg (69.4 kB)
more ▼

asked May 09 '18 at 09:31 AM in Blueprint Scripting

avatar image

Glzmo
56 6 4 10

avatar image Glzmo May 09 '18 at 09:44 AM

This is my current logic with half works. but cause rotation seems to go to 90 then 0 if changes to dive graphics whenever there up straight as well as when upside down.

![alt text][1]

avatar image Velrin May 09 '18 at 11:01 AM

Hey Gizmo,

Your screenshot did not appear to post properly. I've had some experience using a phone's gyro device while programming for Unity and it usually returns a value between 1 and -1.

There are multiple ways to implement the rotation of the character. Do you want it to constantly rotate with the changes to the device's orientation? Or just change the character's rotation to face down when the device has been found to be tilted down?

avatar image Glzmo May 09 '18 at 07:46 PM

![alt text][1]

untitled-1.jpg (63.7 kB)
avatar image Glzmo May 09 '18 at 07:52 PM

I have the tilt connected to the rotation rate so you can spin the character back and forth but not directly connected to the tilt direction. I want to know when the character is facing directly down and probably about 10 degrees each way from straight down

avatar image Glzmo May 09 '18 at 07:52 PM

alt text

untitled-12.jpg (73.8 kB)
avatar image Glzmo May 11 '18 at 05:40 AM

counting rotations is seriously close to impossible in unreal. i'm sure i will be a bald man by the time i work this out

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

1 answer: sort voted first

For the Record i'm not a bald man.

however i did work it out counting rotations i used the rotation rate to add to a variable which counted up to 360 then would set flips to 1 and reset to 0 or same in reverse.

and as for the flipping i had to use X as well as Y so when ever X was between -10m and 10 and Y was > 170 dive was true,

hope this helps for anyone else

more ▼

answered Aug 22 '18 at 08:27 AM

avatar image

Glzmo
56 6 4 10

(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