1 registered members (AndrewAMD),
1,244
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: [Newton] Car weapons
[Re: FoxZero]
#49289
07/17/05 21:37
07/17/05 21:37
|
Joined: Sep 2002
Posts: 344 São Paulo SP Brazil
Marcio Esper
Senior Member
|
Senior Member
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
|
I am working with this kind of problem now. when I solve this problem I tel you how you can do this. First I need solve the enemy target camera problem, it change the orientation if the car change the direction. best regards, Marcio
|
|
|
Re: [Newton] Car weapons
[Re: FoxZero]
#49291
07/20/05 06:30
07/20/05 06:30
|
Joined: Sep 2002
Posts: 344 São Paulo SP Brazil
Marcio Esper
Senior Member
|
Senior Member
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
|
I am testing here and you can use like a normal weapon in a player, but you need change the templates. I am having problems here with the target. I make a tower gun, like the picture, and it direction is set by bone. when I move the mouse the tower move and the target camera move with the ang_for_bone(map_cam2.pan,torres,"arms"); But when I put this to set a bullet direction, it not work. I think I will start again the weapon code, the actual has a lot of bugs. best regards, Marcio
|
|
|
Re: [Newton] Car weapons
[Re: Marcio Esper]
#49292
07/22/05 22:34
07/22/05 22:34
|
Joined: Jun 2005
Posts: 1,001 Pennsylvania, USA
FoxZero
OP
Serious User
|
OP
Serious User
Joined: Jun 2005
Posts: 1,001
Pennsylvania, USA
|
Cool weapon. It's just like the weapon in the game Freelancer. I think that game is one of the greatest PC space games I ever played! The guns would ajust to fire where the curser was. Normal guns had limited rotating and tilting capabilities. The turrets on your ship would be able to rotate 360 degrees. When you pressed the look back button the turrets would attomaticaly swing back and you could fight off your attacker without facing him. The mouse would also simultaneously move the ship. You should definatly try something like that. It was the best targeting system ever. Good luck! Edit: Hey cool I'm a member now!
Last edited by FoxZero; 07/22/05 22:35.
|
|
|
Re: [Newton] Car weapons
[Re: Marcio Esper]
#49294
07/25/05 11:29
07/25/05 11:29
|
Joined: Sep 2002
Posts: 344 São Paulo SP Brazil
Marcio Esper
Senior Member
|
Senior Member
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
|
here is the weapon code please if you use it, put my name in the credits. you will ned adapt it to your needs, I have a tower gun entitie name torres, you need choose an entitie to be a gun and put the vertex of start and end the gun tuble. sorry my english is terrible. Code:
//bullet code by Marcio Esper //using NGD 1.51 // you need a gun entitie to set the bullet origen //you need a bullet model //examine the code, some things you can delet if i forget in the code
entity* projetil;
var destino[6]; var origem[6]; var final [6]; var newtonImpulseRecord[8];
function baladata(material){ var collisionType; var body; dll_handle = newtonHandle; body = NewtonGetBody (my); collisionType = my.collision_sph_box; body = NewtonAddMapEntity (my, collisionType); NewtonSetBodyMass (body, my.mass); NewtonSetBodyLinearDamp (body, my.linear_drag); NewtonSetBodyAngularDamp (body, my.angular_drag_x, my.angular_drag_y, my.angular_drag_z); NewtonSetBodyForceAndTorque (body, ApplyGravityForceEvent); NewtonSetBodyMaterial (body, material); NewtonSetBodyActiveState (body, my.start_active); vec_for_vertex(destino, torres, 130); vec_for_vertex(origem, torres, 78); //vec_diff (final,destino,origem); not need this //ENT_playSOUND (torres, bum, 100); - uncoment and make a sound if you need it // gun end of tuble point newtonImpulseRecord[0] = destino.x; newtonImpulseRecord[1] = destino.y; newtonImpulseRecord[2] = destino.z; // origin of bullet (use to determone the direction of the impulse) newtonImpulseRecord[3] = origem.x; newtonImpulseRecord[4] = origem.y; newtonImpulseRecord[5] = origem.z; // copy the bullet mass - change it to more or less distance and damage newtonImpulseRecord[6] = 10000; // copy the bullet speed - change like above newtonImpulseRecord[7] = 900; NewtonBodyAddImpulse (body, newtonImpulseRecord);
}
action bala{ projetil =me; my.material = cores; my.red=255; my.green=200; my.blue=100; my.lightrange = 400; my.light=on; my.mass =10; my.health = 20; my.shape_factor = 0.9; my.start_active=1; baladata(wood_material); }
Function tiro(){ vec_for_vertex(temp, torres, 130); //get temp the position of vertex ent_create("balabh.mdl", temp, bala); //you need a bullet model, in this case I use balabh.mdl, you can use a little box
}
on_mouse_left = tiro();
I hope it help you. best regards, Marcio
|
|
|
Re: [Newton] Car weapons
[Re: Marcio Esper]
#49295
07/25/05 18:10
07/25/05 18:10
|
Joined: Jun 2005
Posts: 1,001 Pennsylvania, USA
FoxZero
OP
Serious User
|
OP
Serious User
Joined: Jun 2005
Posts: 1,001
Pennsylvania, USA
|
Thank you so much for your code! I will definatly credit you if I put this on the net. One question though. I changed the code like you said, but I don't know what the 'cores' material is. Could you please tell me what it is so I can define it? I only know the basic of programming and very, very little about Newton. [EDIT]: Nevermind, I figured it out.
Last edited by FoxZero; 07/25/05 18:18.
|
|
|
Re: [Newton] Car weapons
[Re: FoxZero]
#49296
07/26/05 01:35
07/26/05 01:35
|
Joined: Sep 2002
Posts: 344 São Paulo SP Brazil
Marcio Esper
Senior Member
|
Senior Member
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
|
Hi,:) The cores material it is just a material effect for the bullet, you can remove it safely. Code:
action bala{ projetil =me; //my.material = cores; my.red=255; my.green=200; my.blue=100; my.lightrange = 400; //it is for light, change the range to your enviroment looks bether my.light=on; my.mass =10; my.health = 20; my.shape_factor = 0.9; my.start_active=1; baladata(wood_material); }
best regards, Marcio
|
|
|
|