How do I get this floating object to rotate and face the direction my left stick is pushing in?
When I sat down to do this one, I honestly thought it would be quite a simple task...and I still suspect that maybe it is and I'm just missing something a bit obvious.
Let's say I've got a floating UFO, just hovering above the ground. All I want to do is to get it to rotate around it's own 'local' Y axis (so cannot use Rocket Rotator, must be local rotation) until it's facing whatever direction my left stick is pointed in.
I'm getting the left stick output from page 2 of the Controller Sensor (so up on the stick is always away from camera for example) as I want the UFO to have camera relative control.
I know how to use rotators and stuff but can't figure out the easiest way of getting it to recognise when it's facing the direction I am pushing on the stick.
I noticed that a puppet has a 'Turn To Face' input, anyone know how the logic for that might work exactly?
All I can really think of at the moment is that maybe I need to dust off the old maths book and treat it as a vector problem, using the X and Y values from the stick to figure out the direction and then somehow try to equate that with Scene Space Direction. But that seems veeeeery long winded for something that feels like it should be pretty straight forward. ( I already ended up with what felt like way too much logic just trying to figure out if it should start turning left or right based on it's current direction!)
Any help with this would be much appreciated!
-
Hi Spirit-X,
You're not alone in thinking this feels like it should be simple, but is in fact quite a challenge to get working as intended. There is a really solid solution that requires actual maths that I picked up from a remixable dream. It's really worth doing it correctly as you then have all sorts of numbers you can adjust to change the feel of the input.
Search the Dreamiverse for 'Joystick Rotator Example'.
I'd also recommend the 2d method of putting a tag in the world and a follow gadget on your UFO. Set the strength and springiness for Y axis to 100% and X and Z to 0 and this will snap to the height that you want your UFO to fly at. -
Hi Spirit-X, I'm not sure whether you're meaning a 3D 3rd person type control or some sort of 2D control scheme where the stick is projected into screen space.
If it's the 3D version you want a simple way to get started is just to use the basic puppet. Tunnel into it and hide all the puppet bits. Stamp your ufo inside the puppet and turn the puppet's turning speed up a lot.
thanks
Matt -
Thanks both.
Pix, great tip. Found the chip you mentioned. Well actually there were a few but one was far and away the simplest, where the guy had just split his right stick into A and C on a splitter, recombined and that fed that into Scene Space Direction on a Look-At Rotator. Actually quite ingenious!
Please sign in to leave a comment.