• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Physics projectiles and image angles [SOLVED]

Warspite2

Member
I have a physics game with a player helicopter. Player presses key to apply physics force on y axis to raise heli. Below are AA tanks which fire bullets at the heli. How can I get the aa bullets to shoot straight? I would rather the bullet not use physics but if I uncheck uses physics then it dont do anything. Not sure how else to tell gms2 to not use physics on this particular object. Basically I just want the aa bullet to fire straight at the player as normal. I also tried other settings such as checking sensor and/or kinematic.

So normally without physics I just use a move_towards_point to achieve this. I seen some other threads here but not complete what I am wanting to do. Any help appeciated and thanks in advance.
 
T

The Shatner

Guest
Warspite2, maybe you could set the physics-related vars of the bullets to ridiculous levels so that they're not actually affected by the physics engine. For example, setting linear and angular damping to 0, setting phy_fixed_rotation to true, etc.
 
P

Pyxus

Guest
I have a physics game with a player helicopter. Player presses key to apply physics force on y axis to raise heli. Below are AA tanks which fire bullets at the heli. How can I get the aa bullets to shoot straight? I would rather the bullet not use physics but if I uncheck uses physics then it dont do anything. Not sure how else to tell gms2 to not use physics on this particular object. Basically I just want the aa bullet to fire straight at the player as normal. I also tried other settings such as checking sensor and/or kinematic.

So normally without physics I just use a move_towards_point to achieve this. I seen some other threads here but not complete what I am wanting to do. Any help appeciated and thanks in advance.
Can you clarify what you mean by unchecking physics doesn't do anything?
 

Warspite2

Member
Thanks guys! It seems setting all fields in physics properties for the bullet to 0 except density to 0.1 is definitely getting on the right track here. Also phy_fixed_rotation set to true solves then crazy spinning bullets. I uncheck uses physics on my bullet and it will be created but not move or anything else. Not sure why I could not just uncheck it and have the object behave normally, that is what I thought it would do. Anyway the bullets seem to work ok like this with the fields set to 0.

Only other issue I am having now is having the turret point at the enemy. Normally I use image_angle = point_direction(x,y,x,y); but seems phy_rotation=point_direction(x,y,oHeli.x,oHeli.y); is what I need to use in a physics world but for one reason or another it does not point at heli and appears to be off about 45 degrees or so. I tried phy_rotation=point_direction(x,y,oHeli.x,oHeli.y)-45 and phy_rotation=point_direction(x,y,oHeli.x,oHeli.y)-180; but no luck. There must be something else I need to do? I will check around more in the forums for this.

Edit: For turret rotation I need to put the minus in like so...

phy_rotation = -point_direction(x,y,oHeli.x,oHeli.y);

In the end my bullet code is as follows and I list it here in case others need help...

Physics Properties:
Density: 0.1
The other 5 fields are 0
Only start awake is checked

Create Event:
phy_rotation = -point_direction(x,y,oHeli.x,oHeli.y);
physics_apply_local_impulse(0,0,1,0);
phy_fixed_rotation = true;

Step Event:
physics_apply_force(x,y,0,-1);
//so it don't slow and fall short

I marked this as solved although I am still unsure what the use for the 'uses physics' box is. Seems as if you have a physics world that box must be checked for the most part.
 
Last edited:
Top