View Full Version : Having Turret turn with Analog Stick
03-25-2011, 05:19 PM
I spent i good amount of time trying to get this to work but could. I am guessing i was making the problem more complicated than it really needs to be.
I need it so putting the stick to the right or left turns the top of the tank only so much. So with a range of 90 degrees in either direction. i want is so if the stick is turned half to the left the turret would turn only 45 degrees and if pushed all the way it would do 90 degrees.
I know i can make it so it rotates and i can just let go when it is as far as i want but that is not what i am trying to do.
Problem is i want its to what the game calls local space. So the joystick rotator doesnt help since it always thinks of it as pointing up where i want to to be pointing forward.
03-25-2011, 05:56 PM
I was pretty sure the joystick rotator had it's arrow-point to work in local space, but perhaps I'm mistaken. If I'm right, then what I wrote below might work:
The joystick rotator rotates an object to an angle arctan(y/x), where y is the up/down speed, x is the left/right speed. x and y are analog values (0-100%) for each axis... see this thread:
It sounds like you're trying to do the same calculation, only you're throwing out y values < 0. Take the up/down output of your analog stick and feed it into a direction splitter. Take the (+) output of the direction splitter and feed it into the (+) input of a direction combiner. Do not connect the (-) ends. Feed the output of the direction combiner into your joystick rotator, and connect the l/r output as normal.
Now, if I'm wrong about the joystick rotator, then your next best bet is probably to use a wobble bolt, since you are limiting the angle by which your object can rotate. You could remap the L/R outputs of the analog stick into the bolt, set to directional. It's not going to give you the same result as a joystick rotator, but left/right on the stick will rotate your turret counterclockwise/clockwise.
Hope this helps.
03-25-2011, 06:21 PM
Thanks for the help but i tried all that.
For some reason the joystick rotator does not have a local space setting like the other rotators.
The wobble bolt with 0 resistance and turned off worked great at limiting the move ment.
What i am trying to do is remake Steel Battalion into here. Was planning on using move controls since there were going to come out this month. But now they say some time this year is will be done. Not a good sighn guess there are focusing on getting the lbp in schools things going instead.
The one way i got this to work was having a set of tag sensors hooked up to followers. Then i had a tag set out in front hooked to a holo on the lower section. Each sensor had a stronger and stronger follower attached to it. That way the farther off center the turret was the stronger force was needed to turn it more. This worked perfectly when i manually changed the strength of the main rotator.
But when i tried to use Strength scale it didnt work at all. I assumed that a strength scale ment it would raise the strenth along with the signal but it didn. Maybe i have a setting wrong as the rotator would only activate when i had the stick about half way to the right or left. Then when it would activate it would be all on and go all the way to the side.
Powered by vBulletin® Version 4.1.12 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.