Servo control problem

Hey, i know there are a million threads on this, but none of them that i’ve found have addressed the one problem of how a servo controlled object accelerates to a start, and drifts to a stop. I want my character to start walking at a speed and not have to start out slow, and then get faster, and i also don’t want him to slide as i let go of the button. Help is much appreciated.

Sliding can be solved either by friction, or another Servo actuator that activates when your movement actuator isn’t activated. You’d set 0 as the velocity and min and max force set for the axis you want to stop (maybe forces of -50 and 50).

Higher max forces will result in a faster acceleration. You can also mess with min force and the “I” and “P” values. Increase I for a faster response.

-Sam

Thanks, i fixed the sliding and acceleration problem, so i figured i would do the same thing for going backwards except make everything negative, but that didn’t work to well, not only does he not go backwards, but after i press S, then try to press W to go forward, everything is screwed up, take a look http://www.mediafire.com/download.php?ttegr4nmz2m

hi lipsonfire,

Here’s the setup I like for movement with the Servo Control. It let’s you start and stop instantly. It uses States and the delay sensor.

Clark

Attachments

Move_ServoControl.blend (355 KB)

This is needlessly complicated, and it doesn’t let you change direction quickly.

Really, friction is the best way to do this. There’s no reason that it has to be hard.

Make sure that you’re selecting the material of your GROUND faces (I notice you have a different “concrete” material for that) and set friction to a good amount (like 1 or 2). Now make your servo motion have a pretty high max force (like 100) for your main character. You can add friction to your character’s material as well and play with that. Also, check out the “damping” setting as well.

Look at my Cube game for semi-instant movement. It’s in the Game Competition Entries thread that’s stickied to this forum.

-Sam

Alternately you could use python and setLinearVelocity (I don’t recommend just logic bricks as then gravity is nonfunctional- in python you can use setLinearVelocity([Whatever,Watever2,Zvelocity]) to retain gravity)

i got it gravity to function with servo motion, i just pressed that big Z button, i guess that tells it that i want the Z axis to be factored into the movement. And i guess i can give friction and damping a go, i found damping, but where is friction?

Servo allows you to factor in gravity, but it doesn’t seem to work very well- using python gives you a lot more control over movement.

I think that a lot of people seem to have issues when they don’t select all 3 axes on the servo control actuator. When you don’t have the button selected, servo seems to act like a normal motion actuator with linV enabled. So… when you have the Z axis linV value as “0” but don’t have the button checked, when the actuator is activated your Z linear velocity is set to 0.

The respective buttons for each axis let you control how much force can be used to obtain a certain velocity. If you push the Z button but don’t specify any force, Servo control won’t interfere with gravity at all… no force can be used on the Z axis to obtain the velocity of zero.

I hope that makes sense. The general rule is: for most movement you want to select all 3 buttons. If you don’t, you’re directly setting the velocity (just like with setLinearVelocity() ).

-Sam

okay cool, i still don’t know where the friction controls are xD

In the material settings, hit dyn. The dialogue switches over to material physics.

@sambassador- Regardless of the settings used, servo actuators generally limit what you can do with movement to a few certain options, and when you combine several servos you can easily run into strange problems. That’s why I prefer to use python, and skip all the irritation.

Isn’t that the case with any actuator? Of course you’re going to have more control with Python… but that doesn’t mean that Servo is “bad” nor does it mean that it’s not appropriate for his solution. For a general “go and stop” movement (like in an FPS) servo works fine. If you’re doing some sort of flight simulator… yes, you’re going to have problems with getting realistic movement.

If you need absolute control over everything, then Python is the obvious choice. However, I don’t think that there’s anything wrong with using Servo for basic movement, and it DOES give more control than the basic motion actuator.

What strange problems do you run into? I’ve used several servos at once and have never had any problems.

-Sam

Mostly I run into a cap speed issue- if I have a servo for forward, and one for moving right, and the player uses both at once, even if they both have the same max speed, the character ends up going slower than it should- if I want it to have a max speed of 3 in any given direction, it ends up going about 2.1 on diagonals.

I only get that when I didn’t tick all the x, y, and z buttons. If you set everything up right, it actually ends up going faster on diagonals

On the topic, I find the best way to get servo controlled object to stop quickly is 2 servos: one that is activated when niether up nor down is pressed, with x, y, and z ticked,and min and max set at what you used for up and down movement, and a similar one for left and right.

This method will make make you skid slightly when you stop, depending on how high/low you set min/max. I prefer this over stopping instantly.

That setup is not that bad, I guess.

thanks, friction did the trick. However i’m still having problems with going left and going backwards, negative values don’t seem to work with servo control, a little enlightenment?

Try the attached setup.
As an explanation to your problem with negative values, say you want your object moving at a speed of -5 along it’s y axis (that would be backward). You would have to set a negative value in the “min” box. The way you’re doing it, Blender is trying to give negative movement using positive force, because you’ve set a positive “max” value.

Attachments

servo control.blend (247 KB)

ah all is fixed, thank you very much! :smiley:

Still playing with friction… :spin:
Im"very"ho that’s a fix, not a solution. At all.

… :no: