|
Re: physical
[Re: GaniX]
#427345
08/06/13 22:19
08/06/13 22:19
|
Joined: Feb 2010
Posts: 886
Random
User
|
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
|
|
|
Re: physical
[Re: Random]
#427356
08/07/13 07:20
08/07/13 07:20
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
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:
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]
#427410
08/07/13 17:17
08/07/13 17:17
|
Joined: Feb 2010
Posts: 886
Random
User
|
User
Joined: Feb 2010
Posts: 886
|
Fist you have to initialize physX. Do it in your main script:
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.
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
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|