Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
physical #427336
08/06/13 19:54
08/06/13 19:54
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
hello all.
I'm trying to make a code of a fps game , the shot will be simulated using an xray for a trace.
the problem I have is that: when one shoots(a trace hit when mouse left click) a metal box for example, this box still like a solid box and dotīt move , I want this box to make a more realistic movement using the physics of the shot, using the physical movements.
but I have not much idea of ​​how to make the code because i have not so much idea how is this language is tray the physics , can anybody help me?

Re: physical [Re: GaniX] #427345
08/06/13 22:19
08/06/13 22:19
Joined: Feb 2010
Posts: 886
Random Offline
User
Random  Offline
User

Joined: Feb 2010
Posts: 886
I suppose you use PhysX. Do you know how to initialize PhysX?
And post the script you wrote, let`s see what you have done there and then I am going to show you how to actually use PhysX wink



Re: physical [Re: Random] #427356
08/07/13 07:20
08/07/13 07:20
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Well, there are some more ways to do this.
One idea would be to simply write a skill (lets take 23) and put it on a specific value (lets take 1337). Now in your trace you check for you. If you is valid check the skill, if its 1337 you have to create a vector (depending on the mass of the box and strength of the weapon). You also need to apply the force on the position where you hit the box, here we will use "USE_POLYGON" in the trace so we can later apply it on the hit position:

Code:
if(c_trace(..))
{
	if(you)
	{
		if(you.skill23 == 1337)
		{
			VECTOR vForce;
			vec_set(vForce, vector(100, 0, 0));
			vec_rotate(vForce, pTraceHit.rotation);
			pXent_addforceglobal(you, vForce, hit.x);
		}
	}
}



Edit: Heres a little preview how it will look like: www.youtube.com/watch?v=daRrCOQxsiY

Last edited by Ch40zzC0d3r; 08/07/13 07:53.
Re: physical [Re: Ch40zzC0d3r] #427403
08/07/13 15:10
08/07/13 15:10
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
s for help.
ok i study the code off the erthball8 of the samples to make that, but still have a problem.
if the trace hit a box in the superior part the box must rotate back , but in this case thats not happend . but is a good start to study this.

Ch40zzC0d3r: can you pls explain to me something more about your idea because its sound like something i need

Re: physical [Re: GaniX] #427408
08/07/13 15:44
08/07/13 15:44
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Well, I gave you the code to archieve this, you just need to pass the right arguments to the c_trace, also pTraceHit.rotation in my example is camera.pan for sure.

Re: physical [Re: Ch40zzC0d3r] #427410
08/07/13 17:17
08/07/13 17:17
Joined: Feb 2010
Posts: 886
Random Offline
User
Random  Offline
User

Joined: Feb 2010
Posts: 886
Fist you have to initialize physX.
Do it in your main script:

Code:
function main()
...
	wait(3);
	physX_open();
	pX_setgravity(vector(0,0,-10));
	pX_setccd(1);
	wait(1); 
...



now you can write a simple script for a box for example.
Code:
action PhysX_box()
{
pXent_settype(my,PH_RIGID,PH_BOX);
	pXent_setelasticity(my,80);
	pXent_setdamping(my,20,5);
}



and now you can shoot a box



Re: physical [Re: Random] #427497
08/08/13 16:36
08/08/13 16:36
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
ok thanks now i study all you say, thanks

Re: physical [Re: GaniX] #427625
08/10/13 22:01
08/10/13 22:01
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
ok thanks for helping.
i have a new problem.
the probelm is the box, when i shoot the box can move trought the wall or floor, i read something about use the pX_setccd and pXent_setccdskeleton;then i put on the main this physX_load(); and in the acction of box this pX_setccd ( 1 );
pXent_setccdskeleton( box, vector(0, 0, 0), 1 ); and test, but the problem is continues.
help pls !!!!
thank


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1