applyMovement( ) question

Hi all!

On my quest to make some fun weapons for my game, I have been modifying my laser script to shoot bullets. In the script, I have to use applyMovement( ) to (try) to move a bullet object.

Why use this, you ask? I want to use a ray to ‘hit’ an object (and then deduct the damage etc) so moving bullets is cosmetic (without them it looks a bit odd). Thing is, any object that is dynamic (which you need to move an object via addobject) also interferes with the ray.

I have tried to use applyMovement( ) as it works on ‘no collision’ objects but I cannot get the bullet to move! I realise that I am really setting the position but how would I keep on moving the object?

Here is a portion of the code:


bullet.worldPosition = [6,0,0]
                                                                                                                                                               
movement = [ 0.0, 5, 0.0]
                                
local = True
                                
bullet.applyMovement( movement, local) 

So how do make the bullet in the code above update its position?

Cheers

Paul

I uploaded a example file (probably not needed, but its best to have an example): http://www.pasteall.org/blend/8124

In the blend I have 2 movement scripts, one that uses setLinearVelocity to a dynamic object, and one that uses applyMovement to a static object. - Control adds 1st type, Space adds 2nd type.

To answer you original question: if you set the object as ghost it shouldn’t be seen by the ray.
Ex.

Thanks for the info, but I still get the same problem- I have a fix though- I have a ray slightly offset so the bullets do not hit the ray when fired.

According to your code, every time the script is called the bullet is repositioned in the same place, @ world coordinates [6.0, 0, 0], then displaced by 5 units along the (local) y direction.
What happens if you suppress the first statement?

mb

Set the bullets to no collision, I though ghost did the same thing but appearently it doesn’t.
Ex.