lazers and projectiles?

Hey all, im sorry if im bringing up an FaQ here, but google isnt helping much,
Im trying to get used to the blender ge, and for the most part its going fairly well, but i havent had any luck getting projectiles to work :frowning:
im mostly playing with 3rd person stuff, like tanks, spaceships and adventure game type characters, no serious projects yet, just playing about, but i would like to know how to do things like bullets, arrows and lazers as soon as i can.

any help would be lovely :slight_smile:

P.s,
another thing i would like to do (if possible) is a kindof self righting script or command.
say for example i have set up a simple flight sim, or spaceship rig which travels forward automatically, leaving the pitch and roll in the arrow keys, how would i make it so that the plane or spacecraft automatically turns itself the right way up again when no controls are pressed?

Thanks all :smiley:

-Ted, Away!

self righting?

self correcting? I dunno XD Stabilizing perhaps… Anyway if you look at lasers, bullets and arrows as a whole you’ll see them as projectiles. However one cannot apply the same rules on arrows and bullets and lasers.

A bullet will most likely create debris, an arrow will not.
A bullet will most likely shatter its target, an arrow will not. (head shot for example)
A bullet will usually pass through its target, an arrow will not.
A bullet will stay in its target untill removed by a medic, an arrow can usually be pushed through or pulled out by savage means.

Lasers on the other hand just have to be avoided period. (don’t get hit by 'em that is)
So based on a rules like those or perhaps an entirely different set of rules (It’s the game world we can do whatever we want XD) Now I don’t want to explain the entire process. so I’ll just make a demo :wink:

Yeah yeah, stabilizing is exactly what im after, any idea how to do that?

and with regards to the projectiles, i know that they are all completely diffrent from a mechancal or physical point of view, i was really just after some basic idea of how to get started with them in blender since i have only really within the last 48hours used the blender GE,

but for the record, since i got back from work, youtube has been a big help :slight_smile:

as far as projectiles go, create your projectile object, and put in on a different layer than what your game is on, give it an always > AND > Motion logic setup, with the motion being a loc in the x or y(your choice). in the main layer add an empty where u want the projectile to come from and give it the sensor of your choice > AND > Edit object(add object) logic setup, and put the name of your projectile in for the object to add, and time in seconds for how long the the object will stay in the game(if left at 0 it will stay forever). that’s pretty much it. all though that will give a straight line projectile, more like a laser, if you want to give it a more relistic motion, make the projectile a dynamic actor and remove it’s logic bricks all together, then on the emitters logic setup add linv to the x y and z to give it it’s initial velocity. play around with it till you find what u want

Yeah, thanks, thats pretty much what i did, but it went crazy.
have a look at the blend file i posted in a diffrent thread and see if you can tell me why.

or dont. meh.

For the stabalization script I believe you can use the logic bricks.

What you’d have to do would be compare the current rotation with the “stabalized” rotation. More than likely, your stabalized rotation would be a a y-rotation of 0. You’ll probably need 6 different actuators: 2 for each rotation axis, one for too high and one for too low.

I believe you can do this with the expression operator. You’ll have to look up more about this, because I’m not confident enough with it to give you instructions.

If you wanted the stabalized movement to be smooth, it’d be good to use the torque movement. However, if this might cause unwanted movement (systematic over-correcting, resulting in a ship that repeatedly bobs up and down like a bouy). If this is the case and you can’t correct it, use rotation-velocity, or just brute force it by adding/subtracting to the “rot” attribute.

If you really wanted to get fancy, add a timer attribute to the object and once it reaches a certain time after the user’s last command, start to correct. This shouldn’t be that hard.

I’m not being very specific here so sorry if I’m confusing you. Otherwise good luck! And post your blends if you ever make anything cool.