Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 552 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 40 of 41 1 2 38 39 40 41
Re: Newton 2 wrapper [Re: yorisimo] #395777
02/27/12 15:27
02/27/12 15:27
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Hey me again.
I added this to my project to the bullet:

Code:
ent_create("shells/9mm.mdl", player.x, bullet_phys);

action bullet_phys()
{
	wait(3);
	newton_addentity(me, (float)75, NEWTON_CYLINDER, onforceandtorque);
	//set(me, PASSABLE);
	//pXent_settype(me,PH_RIGID,PH_CAPSULE );
	//pXent_setccdskeleton( me, vector(0, 0, 0), 0 );
	//pXent_setelasticity(my, 10);
}



Now its crashing with this message:
Empty function called in newton_addentity

What im doing wrong?

Re: Newton 2 wrapper [Re: Ch40zzC0d3r] #395786
02/27/12 16:27
02/27/12 16:27
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline
Member
yorisimo  Offline
Member
Y

Joined: Mar 2007
Posts: 197
Did you include all the necessary files in your project:
newton.dll, newton_main.c, newton_debug.c, matrix.c, etc.

Make sure you read howtouse.doc that comes with the Newton 2 wrapper stuff.


Joris Lambrecht
My Contributions: Relative Rotation, Window Sizing
Re: Newton 2 wrapper [Re: yorisimo] #395794
02/27/12 17:40
02/27/12 17:40
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
I fixed it. Problem was I put all in another folder then my script idk why it doesnt work then but now it works...

Re: Newton 2 wrapper [Re: Ch40zzC0d3r] #395807
02/27/12 18:40
02/27/12 18:40
Joined: Aug 2011
Posts: 133
Germany, Supergeheimes Hinter-...
G
gameplan Offline
Member
gameplan  Offline
Member
G

Joined: Aug 2011
Posts: 133
Germany, Supergeheimes Hinter-...
Does anyone know how to connect two entities with a Hinge (code?) ?


Version: A8 free
OS: Windows 10
Re: Newton 2 wrapper [Re: gameplan] #395811
02/27/12 20:38
02/27/12 20:38
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Look at the website for 3dgs codes. You can download them.
They are made with A6 but i dint think thats the problem laugh

Re: Newton 2 wrapper [Re: Ch40zzC0d3r] #395813
02/27/12 21:15
02/27/12 21:15
Joined: Aug 2011
Posts: 133
Germany, Supergeheimes Hinter-...
G
gameplan Offline
Member
gameplan  Offline
Member
G

Joined: Aug 2011
Posts: 133
Germany, Supergeheimes Hinter-...
Yes, but I need the codes for Newton Dynamics, which arent in the official codelist. Or did I missunderstood something?

Last edited by gameplan; 02/27/12 21:16.

Version: A8 free
OS: Windows 10
Re: Newton 2 wrapper [Re: VeT] #399667
04/18/12 09:44
04/18/12 09:44
Joined: Apr 2012
Posts: 4
H
Heri Offline
Guest
Heri  Offline
Guest
H

Joined: Apr 2012
Posts: 4
whether we can simulate the newton dredging of soil?
like this : http://www.youtube.com/watch?v=wrYa4JPXoAA&feature=fvwrel

Re: Newton 2 wrapper [Re: Heri] #399812
04/20/12 14:25
04/20/12 14:25
Joined: Apr 2012
Posts: 62
wrekWIRED Offline
Junior Member
wrekWIRED  Offline
Junior Member

Joined: Apr 2012
Posts: 62
I was also looking for a hinge code. can't find it or i just pass by it. By the way. Already got the grab code working but i wasn't the one i needed. It was the power mouse but i still have to figure out how to pick stuffs while in FP view and apply weight to objects. If someone can help me regarding this one i would be thankfull.

Last edited by wrekWIRED; 04/20/12 19:27.
Re: Newton 2 wrapper [Re: Heri] #399835
04/20/12 19:47
04/20/12 19:47
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Originally Posted By: Heri
whether we can simulate the newton dredging of soil?
like this : http://www.youtube.com/watch?v=wrYa4JPXoAA&feature=fvwrel

What you see in the video isn't anything with the physics engine, it is fake. Means, it is by moving the vertices of the model where the shovel touchs the soil and moving the vertices of a hidden mdl within the shovel to make the soil appear in the shovel. The rest are particles.

Re: Newton 2 wrapper [Re: Pappenheimer] #399846
04/21/12 03:53
04/21/12 03:53
Joined: Apr 2012
Posts: 62
wrekWIRED Offline
Junior Member
wrekWIRED  Offline
Junior Member

Joined: Apr 2012
Posts: 62
Anyone can help in converting or intigrating this newton code to lite-c? http://newtondynamics.com/forum/viewtopic.php?f=9&t=6706

Code:
/*
Containing class vars:
handOrn = target orientation quaternion
hand pos = target position
... interpolated values to follow point in front player camera somewhat smoothly
*/

void AccumulateForce (float timestep)
   {
      //position... (code from older newton demos)

      if (!pickedBody) return;
      float MOUSE_PICK_DAMP = 20.0f;
      float MOUSE_PICK_STIFFNESS = 150.0f;
      float ANGULAR_STIFFNESS = 0.1f;

      float mass;
      float Ixx;
      float Iyy;
      float Izz;
      sVec3 com;
      sVec3 veloc;
      sMat4 matrix;
      BodyGetMatrix(pickedBody, matrix);

      BodyGetVelocity (pickedBody, veloc);
      BodyGetMassMatrix (pickedBody, mass, Ixx, Iyy, Izz);

                sVec3 pickedForce = handPos - matrix[3]; // body position
      float mag2 = pickedForce.SqL();
      if (mag2 > 20.0f * 20.0f) pickedForce *= 20.0f / sqrt (mag2);
      sVec3 force (pickedForce * mass * MOUSE_PICK_STIFFNESS);
      sVec3 dampForce (veloc * mass * MOUSE_PICK_DAMP);
      force -= dampForce;
      sVec3 grav (0.0f, mass * GRAVITY_Y, 0.0f);
      force -= grav;

            
      BodyData *data = (BodyData*) BodyGetUserData (pickedBody); // containing force and torque vectors, which are the applied in the callback
      
      data->force += force;

      // orientation...
      sQuat q;
      BodyGetRotation (pickedBody, q);

      sVec3 curAngVel;
      BodyGetAngVel (pickedBody, curAngVel); // == NewtonBodyGetOmega
      
      sVec3 targetAngVel = AngVelFromAToB (q, handOrn) * (1 / timestep * ANGULAR_STIFFNESS);
      sVec3 torque = ConvertAngVelToTorque (targetAngVel, curAngVel, matrix, timestep, mass, Ixx, Iyy, Izz);
      data->torque += torque;

      BodyActivate (pickedBody);
   }



// utilitys...


// convert rotational offset to angular velocity (divide by time afterwards)
inline sVec3 AngVelFromAToB (const sQuat &qA, const sQuat &qB)
{

   const float matchTolerance = 0.01f;
   const float faultTolerance = 0.05f;

   sQuat q = QuatFromAToB (qA, qB);
   sVec3 *omegaDir = (sVec3*)&q;
   float sql = omegaDir->SqL();
   if (sql   < (matchTolerance * matchTolerance))
      return sVec3 (0, 0, 0);

   float length = sqrt (sql);
   if (q[3] < -1) q[3] = -1;
   if (q[3] >  1) q[3] =  1;
   sVec3 angVel = (*omegaDir / length) * (2.0 * acos(q[3]));
   if (length   < faultTolerance) angVel *= (length - matchTolerance) / (faultTolerance - matchTolerance);
   return angVel;

}

// choose shortest rotation between 2 orientations
inline sQuat QuatFromAToB (const sQuat &qA, const sQuat &qB)
{
   sQuat q;
   if (qA.Dot(qB) < 0.0f)
   {
      q[0] = qA[0]; q[1] = qA[1]; q[2] = qA[2];
      q[3] = -qA[3];
   }
   else
   {
      q[0] = -qA[0]; q[1] = -qA[1]; q[2] = -qA[2];
      q[3] = qA[3];
   }
         
   return qB * q;
}

inline sVec3 ConvertAngVelToTorque (   sVec3 &targetAngVel, sVec3 &currentAngVel, sMat4 &matrix,
                        float timestep, float mass, float Ixx, float Iyy, float Izz)
{
   sVec3 torque = (targetAngVel - currentAngVel) / timestep;
   torque = matrix.Unrotate (torque);
   torque[0] *= Ixx;
   torque[1] *= Iyy;
   torque[2] *= Izz;
   torque = matrix.Rotate (torque);
   return torque;
}



I understand some of newton dynamic's function but don't understand the variables thats why i use 3dgs to make my game. Wish i can translate the code my self but been working for weeks now just to get my game physics working and can't go on without it.
Thanks guys.

Last edited by wrekWIRED; 04/24/12 11:39.
Page 40 of 41 1 2 38 39 40 41

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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