Logic Brick Solution? (how-to start from dead halt rather than flight in progress)

Hi Everyone,

This is my first post here, so yes… I’m that addicted to blender. I am seeking help-- Not that kind of help, actually, I’m hoping for a better fix…

Here’s my problem: I’m building a simple starship (which looks suspiciously like a tie fighter). Thus far, I’m using logic bricks to define my ship’s controls.

So: My starship. All of my controls are working fine. However, when I start the game engine, my ship is already flying at a rate of .5 (I’m using the “always” function). What I’m seeking to do is start from a dead halt. I am seeking to create a “start thrusters” command with a logic brick.

I don’t want to hold down a key to move forward. I want to press it one time to “start” my flight, thus attaining full speed from a dead stop with a single keystroke. (optionally, I’d like to press 1,2,3,4,5 to control my forward speed)

Currently: My ship is moving when the game starts. I would like to be at a dead halt when the game starts. Then, I want to press the “+” key to begin moving forward. I want to press it only one time to get to the assigned speed. Then, “-” to come to a halt without holding the “-” key to keep myself in place.

Is this possible with logic bricks, or do I need to seek some kind of code?

Ultimately, I’d like to have space act like a vaccum, in that once I have inertia in any direction, I continue to move in that direction, as I would in a vaccum. This would add a sense of realistic space flight. However, for the moment, I’m still struggling with trying to get my ship launched from a dead stop, rather than starting the game already in motion.

Thus: If logic bricks will work, can someone suggest what the three bricks would be set at?

Any advice would be most appreciated. I am assuming that I’m not the first person to ask this question, but as you might have guessed… I’m not entirely sure what vocabulary words to use to begin my forum search. Yes, I’m a blender noob, and I would be chagrined if anyone referred to me as any sort of “coder.” I’m willing to learn, but I’m hoping I can limp forward using logic bricks.

Thanks in advance for any help.

use “States” , maybe?
State1 - Not moving state
Some event Sensor - > AND - State Actuator - Set State 2
State 2
Always Sensor -> AND -> Action Actuator ?
And so on

Make sure you have gravity set to 0 (in the world tab). If it’s set to 0, then objects shouldn’t move when you start the engine. Also ensure you don’t have objects intersecting with your ship. If physics objects are intersecting other physics objects, Bullet (the Blender Game Engine’s physics engine) will do its best to separate them.

I would (on “start” gradually nullify gravity)

Keypress-On---------------and-----------------property toggle “On”
Property On=1 ------------and-----------------Force 9.8 (if ship weighs 1)

(on planet)

in space
Track to nearest property “Planet” on a rigid body set to ghost pinned to Center
if ship is off,apply force aligned with track to axis
I have one of SDGEOF’s old scripts that does the track to nearest bit,

I would have throttle set like this
Key-press “throttle up” --------------------and-----------------property “Gas” add 1
(property )if gas is 0-(max-1)-------------------------/
Key-press “throttle down” --------------------and-----------------property “Gas” add (-1)
(property )if gas is 1-max

then you can have
if gas= 1 -------------and----------------force throttle
if gas= 2 -------------and----------------force throttle1.5
if gas= 2 -------------and----------------force throttle

Also (SDGEOFS track to nearest property should be part of the trunk with a UI interface)

Wow, awesome! Ok, I’ll fiddle with this and let you know how it works (I have a great deal of confidence that it will.) Thanks so much for your efforts, I’ll do my best to put them into action. Thanks again :slight_smile:

Ok, thanks kindly for your input, it’s given me a lot to consider, but this just isn’t working. The states idea has gone over my head, so it may be the best solution.

However, let’s simplify the problem a bit, and I’ll complicate the problem with a few further questions as I make each part work. I’ve been thinking the problem through, and I think I’ve been approaching it bass-ackwards, or imagining the whole concept of how I want my ship to fly in all the wrong ways (ie, not like a tie fighter, but more like the ship in Asteroids.)

So… Maybe the world tab is the best place to start.

(Assuming my “always” logic cube sets my default motion to zero…)

Let’s look at this differently… I’m seeking ideas on how to make my ship fly like the ship in the atari game Asteroids. What I first want to achieve is a zero gravity environment.

If I spurt the thrusters I will go forward. I don’t want my ship to come to a dead halt after I stop holding down the thruster key, so I think the easiest way to achieve this is in the world tab. Thus, conceptually speaking, I think that I need to turn on “inertia 100%” or turn off “drag” or… something (not sure how blender describes this physics activity.)

My hope is that by making the world “behave” I can achieve my goal of making my ship fly forward on it’s own power without having to constantly hold down a key to make it go forward… Once the motion is created, it should keep moving in that direction until I change direction and hit the thrusters again (like the ship in Asteroids flies… out of control? yes… But? Maybe I can live with that challenge, or simplify it down the road with states.)

Thus, I think the world tab settings is the best place to start. Maybe I’m wrong. However, if you can help me set up that kind of space vaccum behavior, I would be most appreciative. I have been fiddling with the world tab settings, but setting gravity to zero, and drag to zero seems to not be doing anything, so I’m clearly missing a step or two… Any ideas what other tabs I should change?

Keyboard ---------------------------------------------and---------------------Property = Property +1
if property (interval) is less then (5)---------/

Keyboard throttle down------------------------------and---------------------Property = Property +1
if property( interval) is greater then 1------------/

if property = 1-5-------------------------------------and---------------------motion force
if property = 2-5-------------------------------------and---------------------motion force
if property = 3-5-------------------------------------and---------------------motion force
if property = 4-5-------------------------------------and---------------------motion force
if property = 5 ---------------------------------------and---------------------motion force

so basically the forces are cumulative an are linked to the property
higher property = more speed without holding a button

and this
keyboard (grav On)------------------------\

____________/---------------------------and-------------------------property Grav = 1
if property is 0-1--------------------------and-------------------------property Grav = 0

keyboard (grav off)------------------------/

if Grav = 0 -------------------------------------------------------------motion 9.8 Z
if Grav = 1--------------------------------------------------------------motion 0.0

To answer your first post, try this blend (attached). It works by having a Boolean property (Go) set an Edit Object block (Suspend Dynamics). Suspend Dynamics freezes your dynamic object until Go is True- once the object is unfrozen it will move as normal. Also, there is a property (OnceOnly) that stops the SPACEBAR from stopping and starting the cube (so the SPACEBAR only works once).

Hope it helps you- any questions just ask.




StartStop.blend (79.8 KB)

here is a key press limiter in logic

Keypress “Any” ----------------------------and-------------------------X=1
if X=0-----------------------------------------/

If X is less then 10 but more then 0—and-------------------------X=X+1

if X =(Number of frames to wait)-------and-------------------------X=0

Thanks Blueprint, Rubber, et al. I am clearly in over my head, which is the perfect place to learn to swim. I’ll have to study this a bit further, but this is pretty clearly the direction I need. Again, thanks for your gracious efforts, I will do my best to make a success of your advice.

:slight_smile: If it was easy, then it wouldn’t be nearly as satisfying to meet with success. Thanks for pointing this uber noob in the right direction. :slight_smile:

Yep Rubber, that works like a charm! I never would have figured that out… Now I shall study it and figure out how it works :slight_smile: Thanks again :slight_smile: Blueprint, your efforts will not go to waste, I want to see this happen :slight_smile: Kinda like reversing every other tutorial I’ve seen regarding physics :slight_smile: Fun!

I have soooo much learning to do.