Newton 2.0x Archemedia Open Beta

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Newton 2.01 Archemedia Open Beta

Postby Julio Jerez » Sun Jun 21, 2009 7:07 pm

Ok I uploaded the last Mac Build. I spent sometime organizing the project file.
Now there are two projects, one for xcode2.5 that run on all Macs, starting with OS 10.4, I think it also works on Macs G3 if the Newton32.a is replace is change to teh NetwonG3.a
The secund project is XCode3.0 that runs on Mac startiong with OS 10.5 or better.
I tested both project and they all run and compile out of the Box.

Remember this changes are just for people to see the demos, this has nothing to do with the SDK, as all teh newton.a runs without problems in all systems.
all of this is just to have working demos for the respective versions of OS X
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby Beauty » Thu Jun 25, 2009 10:38 am

Hi Julio,
just by random I heard above your new version 2.03.
It would be nice if you tell it in this thread when you publish newer Newton versions.
downloads.php
Mogre user
User avatar
Beauty
 
Posts: 30
Joined: Tue Apr 29, 2008 7:37 am
Location: Germany

Re: Newton 2.0x Archemedia Open Beta

Postby JernejL » Thu Jun 25, 2009 11:49 am

The downloads page displays the first post from this forum thread automaticly, so just editing it would work.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 2.0x Archemedia Open Beta

Postby FlemMonk » Tue Jun 30, 2009 1:56 am

I see in the SDK there is a player controller with max slope/stair stepping, if this controller fully implimented and functional in 2.03?

EDIT: Nevermind, I just found out that its actually a seperate CPP source file and utilises custom joints. My real question however is, is Newton 2.0 the same as previous releases where all API is exposed and no C type structures are actually needed?
FlemMonk
 
Posts: 14
Joined: Tue May 26, 2009 5:18 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Tue Jun 30, 2009 3:13 am

The Player controller works, however there is going to be a major update of that controller for Beta 2.04
There are still some glitches on the current one that for me do no pass the quality control test.
However it is fully functional.

As for the AP in 2.0x being like previous one, yes all function of the API are accessible via C interface including the Custom joint library, check out the file CutomJoint.H

I need to make a correction, the idea that Newton is a zero data structure API interface, is not completely true, Newton does has some data structures.

I like to keep it to a minimum but it will be too cumbersome for some function to be implemented without data structures. An example of that is the GetInfo function which report information from collision shapes and Joints. Since the information is variable from shape to shape, the best way to report the information back is by using a union structure and ID.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby FlemMonk » Tue Jun 30, 2009 5:25 am

Thanks for the reply, I did notice the exports for Joints DLL contains PlayerController and that it requires a class, is this just a standard c type class?
FlemMonk
 
Posts: 14
Joined: Tue May 26, 2009 5:18 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Tue Jun 30, 2009 9:20 am

yes you are right I foudn tha out last night, an dI fixe it
these is the repaired files if you want to make the correction before I post the next beta

JointLbrary.h
#ifndef NEWTON_CUSTOM_JOINTS_H_INCLUDED_
#define NEWTON_CUSTOM_JOINTS_H_INCLUDED_


#include "Newton.h"
//#include "CustomJointLibraryStdAfx.h"

#ifdef _NEWTON_USE_LIB
#define JOINTLIBRARY_API
#else
#ifdef JOINTLIBRARY_LIB
#define JOINTLIBRARY_API
#else
#ifdef JOINTLIBRARY_EXPORTS
#define JOINTLIBRARY_API __declspec(dllexport)
#else
#define JOINTLIBRARY_API __declspec(dllimport)
#endif
#endif
#endif



#ifdef __cplusplus
extern "C" {
#endif

typedef struct NewtonUserJoint{} NewtonUserJoint;
typedef int (*PlayerCanPuchThisBodyCalback) (NewtonUserJoint *me, const NewtonBody* hitBody);

// Generic 6 degree of Freedom Joint
JOINTLIBRARY_API NewtonUserJoint *CreateCustomJoint6DOF (const dFloat* pinsAndPivoChildFrame, const dFloat* pinsAndPivoParentFrame, const NewtonBody* child, const NewtonBody* parent);
JOINTLIBRARY_API void CustomJoint6DOF_SetLinearLimits (NewtonUserJoint* customJoint6DOF, const dFloat* minLinearLimits, const dFloat* maxLinearLimits);
JOINTLIBRARY_API void CustomJoint6DOF_SetAngularLimits (NewtonUserJoint* customJoint6DOF, const dFloat* minAngularLimits, const dFloat* maxAngularLimits);
JOINTLIBRARY_API void CustomJoint6DOF_GetLinearLimits (NewtonUserJoint* customJoint6DOF, dFloat* minLinearLimits, dFloat* maxLinearLimits);
JOINTLIBRARY_API void CustomJoint6DOF_GetAngularLimits (NewtonUserJoint* customJoint6DOF, dFloat* minAngularLimits, dFloat* maxAngularLimits);
JOINTLIBRARY_API void CustomJoint6DOF_SetReverseUniversal (NewtonUserJoint* customJoint6DOF, int order);


// player controller functions
JOINTLIBRARY_API NewtonUserJoint *CreateCustomPlayerController (const dFloat* pins, const NewtonBody* player, dFloat maxStairStepFactor);
JOINTLIBRARY_API void CustomPlayerControllerSetPushActorCallback (NewtonUserJoint* playerController, PlayerCanPuchThisBodyCalback callback);
JOINTLIBRARY_API void CustomPlayerControllerSetVelocity (NewtonUserJoint* playerController, dFloat forwardSpeed, dFloat sideSpeed, dFloat heading);
JOINTLIBRARY_API void CustomPlayerControllerSetMaxSlope (NewtonUserJoint* playerController, dFloat maxSlopeAngleIndRadian);
JOINTLIBRARY_API dFloat CustomPlayerControllerGetMaxSlope (NewtonUserJoint* playerController);
JOINTLIBRARY_API const NewtonCollision* CustomPlayerControllerGetVerticalSensorShape (NewtonUserJoint* playerController);
JOINTLIBRARY_API const NewtonCollision* CustomPlayerControllerGetHorizontalSensorShape (NewtonUserJoint* playerController);
JOINTLIBRARY_API const NewtonCollision* CustomPlayerControllerGetDynamicsSensorShape (NewtonUserJoint* playerController);

// Multi rigid BodyCar controller functions
JOINTLIBRARY_API NewtonUserJoint *CreateCustomMultiBodyVehicle (const dFloat* frontDir, const dFloat* upDir, const NewtonBody* carBody);
JOINTLIBRARY_API int CustomMultiBodyVehicleAddTire (NewtonUserJoint *car, const void* userData, const dFloat* localPosition,
dFloat mass, dFloat radius, dFloat width,
dFloat suspensionLength, dFloat springConst, dFloat springDamper);
JOINTLIBRARY_API int CustomMultiBodyVehicleAddSlipDifferencial (NewtonUserJoint *car, int leftTireIndex, int rightToreIndex, dFloat maxFriction);
JOINTLIBRARY_API int CustomMultiBodyVehicleGetTiresCount(NewtonUserJoint *car);
JOINTLIBRARY_API const NewtonBody* CustomMultiBodyVehicleGetTireBody(NewtonUserJoint *car, int tireIndex);
JOINTLIBRARY_API dFloat CustomMultiBodyVehicleGetSpeed(NewtonUserJoint *car);
JOINTLIBRARY_API dFloat CustomMultiBodyVehicleGetTireSteerAngle (NewtonUserJoint *car, int index);
JOINTLIBRARY_API void CustomMultiBodyVehicleApplyTorque (NewtonUserJoint *car, int tireIndex, dFloat torque);
JOINTLIBRARY_API void CustomMultiBodyVehicleApplySteering (NewtonUserJoint *car, int tireIndex, dFloat angle);
JOINTLIBRARY_API void CustomMultiBodyVehicleApplyBrake (NewtonUserJoint *car, int tireIndex, dFloat brakeTorque);
JOINTLIBRARY_API void CustomMultiBodyVehicleApplyTireRollingDrag (NewtonUserJoint *car, int index, dFloat angularDampingCoef);


// BEGIN k00m (Dave Gravel simple raycast world vehicle)
JOINTLIBRARY_API NewtonUserJoint *DGRaycastVehicleCreate (int maxTireCount, const dFloat* cordenateSytemInLocalSpace, NewtonBody* carBody);
JOINTLIBRARY_API void DGRaycastVehicleAddTire (NewtonUserJoint *car, void *userData, const dFloat* localPosition, dFloat mass, dFloat radius, dFloat width, dFloat friction, dFloat suspensionLength, dFloat springConst, dFloat springDamper, int castMode);
JOINTLIBRARY_API void DGRayCarGetChassisMatrixLocal(NewtonUserJoint *car, dFloat* chassisMatrix);
JOINTLIBRARY_API void DGRayCarTireMatrix(NewtonUserJoint *car, int tire, dFloat* tireMatrix);
JOINTLIBRARY_API void DGRayCarSuspensionMatrix(NewtonUserJoint *car, int tire, dFloat param, dFloat* SuspensionMatrix);
JOINTLIBRARY_API const NewtonCollision* DGRayCarTireShape(NewtonUserJoint *car, int tireIndex);
JOINTLIBRARY_API dFloat DGRaycastVehicleGetSpeed(NewtonUserJoint *car);
JOINTLIBRARY_API void DGRaycastVehicleSetCustomTireBrake (NewtonUserJoint *car, int index, dFloat torque);
JOINTLIBRARY_API void DGRaycastVehicleSetCustomTireTorque (NewtonUserJoint *car, int index, dFloat torque);
JOINTLIBRARY_API void DGRaycastVehicleSetCustomTireSteerAngleForce (NewtonUserJoint *car, int index, dFloat angle, dFloat turnforce);
JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresBrake (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresTorque (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresSteerForce (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresSteerAngle (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarTireMovePointForceFront (NewtonUserJoint *car, int index, dFloat distance);
JOINTLIBRARY_API void DGRaycastVehicleSetVarTireMovePointForceRight (NewtonUserJoint *car, int index, dFloat distance);
JOINTLIBRARY_API void DGRaycastVehicleSetVarTireMovePointForceUp (NewtonUserJoint *car, int index, dFloat distance);
JOINTLIBRARY_API void DGRaycastVehicleSetVarFixDeceleration (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarChassisRotationLimit (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerAngle (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerRate (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerForceRate (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerForce (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerSpeedRestriction (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxBrakeForce (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxTorque (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxTorqueRate (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarEngineSteerDiv (NewtonUserJoint *car, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarTireSuspenssionHardLimit (NewtonUserJoint *car, int index, dFloat value);
JOINTLIBRARY_API void DGRaycastVehicleSetVarTireFriction (NewtonUserJoint *car, int index, dFloat value);
JOINTLIBRARY_API int DGRaycastVehicleGetTiresCount(NewtonUserJoint *car);
JOINTLIBRARY_API int DGRaycastVehicleGetVehicleOnAir(NewtonUserJoint *car);
JOINTLIBRARY_API int DGRaycastVehicleGetTireOnAir(NewtonUserJoint *car, int index);
JOINTLIBRARY_API void DGRaycastVehicleDestroy (NewtonUserJoint *car);
// END


// Pick Body joint
JOINTLIBRARY_API NewtonUserJoint *CreateCustomPickBody (const NewtonBody* player, dFloat* handleInGlobalSpace);
JOINTLIBRARY_API void CustomPickBodySetPickMode (NewtonUserJoint *pick, int mode);
JOINTLIBRARY_API void CustomPickBodySetMaxLinearFriction(NewtonUserJoint *pick, dFloat accel);
JOINTLIBRARY_API void CustomPickBodySetMaxAngularFriction(NewtonUserJoint *pick, dFloat alpha);

JOINTLIBRARY_API void CustomPickBodySetTargetRotation (NewtonUserJoint *pick, dFloat* rotation);
JOINTLIBRARY_API void CustomPickBodySetTargetPosit (NewtonUserJoint *pick, dFloat* posit);
JOINTLIBRARY_API void CustomPickBodySetTargetMatrix (NewtonUserJoint *pick, dFloat* matrix);

JOINTLIBRARY_API void CustomPickBodyGetTargetMatrix (NewtonUserJoint *pick, dFloat* matrix);



// genetic joint functions
JOINTLIBRARY_API int CustomGetJointID (NewtonUserJoint *joint);
JOINTLIBRARY_API void CustomSetJointID (NewtonUserJoint *joint, int rttI);
JOINTLIBRARY_API const NewtonBody* CustomGetBody0 (NewtonUserJoint *joint);
JOINTLIBRARY_API const NewtonBody* CustomGetBody1 (NewtonUserJoint *joint);
JOINTLIBRARY_API int CustomGetBodiesCollisionState (NewtonUserJoint *joint);
JOINTLIBRARY_API void CustomSetBodiesCollisionState (NewtonUserJoint *joint, int state);
JOINTLIBRARY_API void CustomDestroyJoint(NewtonUserJoint *joint);

#ifdef __cplusplus
}
#endif


#endif



jointLibrary.cpp
Code: Select all
//////////////////////////////////////////////////////////////////////
#include "CustomJointLibraryStdAfx.h"
#include "JointLibrary.h"
#include "Custom6DOF.h"
#include "CustomPickBody.h"
#include "NewtonCustomJoint.h"
#include "CustomPlayerController.h"
#include "CustomMultiBodyVehicle.h"
#include "CustomDGRayCastCar.h"

// Generic 6 degree of Freedom Joint
NewtonUserJoint *CreateCustomJoint6DOF (const dFloat* pinsAndPivoChildFrame, const dFloat* pinsAndPivoParentFrame, const NewtonBody* child, const NewtonBody* parent)
{
   return (NewtonUserJoint *) new Custom6DOF (*(dMatrix*) pinsAndPivoChildFrame, *(dMatrix*) pinsAndPivoParentFrame, child, parent);
}


void CustomJoint6DOF_SetLinearLimits (NewtonUserJoint* customJoint6DOF, const dFloat* minLinearLimits, const dFloat* maxLinearLimits)
{
   ((Custom6DOF*)customJoint6DOF)->SetLinearLimits (*(dVector*)minLinearLimits, *(dVector*)maxLinearLimits);
}

void CustomJoint6DOF_SetAngularLimits (NewtonUserJoint* customJoint6DOF, const dFloat* minAngularLimits, const dFloat* maxAngularLimits)
{
   ((Custom6DOF*)customJoint6DOF)->SetAngularLimits(*(dVector*)minAngularLimits, *(dVector*)maxAngularLimits);
}

void CustomJoint6DOF_GetLinearLimits (NewtonUserJoint* customJoint6DOF, dFloat* minLinearLimits, dFloat* maxLinearLimits)
{
   ((Custom6DOF*)customJoint6DOF)->GetLinearLimits (*(dVector*)minLinearLimits, *(dVector*)maxLinearLimits);
}

void CustomJoint6DOF_GetAngularLimits (NewtonUserJoint* customJoint6DOF, dFloat* minAngularLimits, dFloat* maxAngularLimits)
{
   ((Custom6DOF*)customJoint6DOF)->GetAngularLimits(*(dVector*)minAngularLimits, *(dVector*)maxAngularLimits);
}

void CustomJoint6DOF_SetReverseUniversal (NewtonUserJoint* customJoint6DOF, int order)
{
   ((Custom6DOF*)customJoint6DOF)->SetReverserUniversal(order);
}




// player controller functions
class PlayerController: public CustomPlayerController
{
   public:

   typedef int (*PlayerCanPuchBody) (NewtonUserJoint *me, const NewtonBody* hitBody);

   PlayerController (const dVector& pin, const NewtonBody* child, dFloat maxStairStepFactor)
      :CustomPlayerController (pin, child, maxStairStepFactor)
   {
      m_canPuchOtherBodies = CanPushThisBodyCallback;
   }

   virtual bool CanPushBody (const NewtonBody* hitBody) const
   {
      if (m_canPuchOtherBodies) {
         return m_canPuchOtherBodies ((NewtonUserJoint *)this, hitBody) ? true : false;
      }
      return true;
   }


   static int CanPushThisBodyCallback(NewtonUserJoint *me, const NewtonBody* hitBody)
   {
      return 1;
   }


   PlayerCanPuchBody m_canPuchOtherBodies;
};

NewtonUserJoint *CreateCustomPlayerController (const dFloat* pin, const NewtonBody* player, dFloat maxStairStepFactor)
{
   return (NewtonUserJoint *) new CustomPlayerController (*(dVector*) pin, player, maxStairStepFactor);
}

void CustomPlayerControllerSetPushActorCallback (NewtonUserJoint* playerController, PlayerCanPuchThisBodyCalback callback)
{
   ((PlayerController*)playerController)->m_canPuchOtherBodies = (PlayerController::PlayerCanPuchBody)callback;
}

void CustomPlayerControllerSetVelocity (NewtonUserJoint* playerController, dFloat forwardSpeed, dFloat sideSpeed, dFloat heading)
{
   ((PlayerController*)playerController)->SetVelocity (forwardSpeed, sideSpeed, heading);
}

void CustomPlayerControllerSetMaxSlope (NewtonUserJoint* playerController, dFloat maxSlopeAngleIndRadian)
{
   ((PlayerController*)playerController)->SetMaxSlope (maxSlopeAngleIndRadian);
}
dFloat CustomPlayerControllerGetMaxSlope (NewtonUserJoint* playerController)
{
   return ((PlayerController*)playerController)->GetMaxSlope();
}

const NewtonCollision* CustomPlayerControllerGetVerticalSensorShape (NewtonUserJoint* playerController)
{
   return ((PlayerController*)playerController)->GetVerticalSensorShape();
}

const NewtonCollision* CustomPlayerControllerGetHorizontalSensorShape (NewtonUserJoint* playerController)
{
   return ((PlayerController*)playerController)->GetHorizontalSensorShape ();
}

const NewtonCollision* CustomPlayerControllerGetDynamicsSensorShape (NewtonUserJoint* playerController)
{
   return ((PlayerController*)playerController)->GetDynamicsSensorShape ();
}


// MultiBody Vehicle interface
NewtonUserJoint *CreateCustomMultiBodyVehicle (const dFloat* frontDir, const dFloat* upDir, const NewtonBody* carBody)
{
   return (NewtonUserJoint *) new CustomMultiBodyVehicle (*((dVector*) frontDir), *((dVector*) upDir), carBody);
}

/*
int CustomMultiBodyVehicleAddTire (NewtonUserJoint *car, const void* userData, const dFloat* localPosition,
                          dFloat mass, dFloat radius, dFloat width,
                          dFloat suspensionLength, dFloat springConst, dFloat springDamper)
{
   dVector posit (localPosition[0], localPosition[1], localPosition[2], 0.0f);
   return ((CustomMultiBodyVehicle*)car)->AddSingleSuspensionTire ((void*)userData, &posit[0],
                                                   mass, radius, width, suspensionLength, springConst, springDamper);
}

int CustomMultiBodyVehicleAddSlipDifferencial (NewtonUserJoint *car, int leftTireIndex, int rightToreIndex, dFloat maxFriction)
{
   return ((CustomMultiBodyVehicle*)car)->AddSlipDifferencial(leftTireIndex, rightToreIndex, maxFriction);
}


int CustomMultiBodyVehicleGetTiresCount(NewtonUserJoint *car)
{
   return ((CustomMultiBodyVehicle*)car)->GetTiresCount();
}

const NewtonBody* CustomMultiBodyVehicleGetTireBody(NewtonUserJoint *car, int tireIndex)
{
   return ((CustomMultiBodyVehicle*)car)->GetTireBody(tireIndex);
}

dFloat CustomMultiBodyVehicleGetSpeed(NewtonUserJoint *car)
{
   return ((CustomMultiBodyVehicle*)car)->GetSpeed();
}

void CustomMultiBodyVehicleApplyTorque (NewtonUserJoint *car, int tireIndex, dFloat torque)
{
   ((CustomMultiBodyVehicle*)car)->ApplyTireTorque(tireIndex, torque);
}

void CustomMultiBodyVehicleApplySteering (NewtonUserJoint *car, int tireIndex, dFloat angle)
{
   ((CustomMultiBodyVehicle*)car)->ApplyTireSteerAngle(tireIndex, angle);
}

void CustomMultiBodyVehicleApplyBrake (NewtonUserJoint *car, int tireIndex, dFloat brakeTorque)
{
   ((CustomMultiBodyVehicle*)car)->ApplyTireBrake (tireIndex, brakeTorque);
}

void CustomMultiBodyVehicleApplyTireRollingDrag (NewtonUserJoint *car, int tireIndex, dFloat angularDampingCoef)
{
   ((CustomMultiBodyVehicle*)car)->ApplyTireRollingDrag (tireIndex, angularDampingCoef);
}

dFloat CustomMultiBodyVehicleGetTireSteerAngle (NewtonUserJoint *car, int tireIndex)
{
   return ((CustomMultiBodyVehicle*)car)->GetSetTireSteerAngle (tireIndex);
}


// Pick Body joint
NewtonUserJoint *CreateCustomPickBody (const NewtonBody* body, dFloat* handleInGlobalSpace)
{
   return new CustomPickBody (body, *((dVector*)handleInGlobalSpace));
}

void CustomPickBodySetPickMode (NewtonUserJoint* pick, int mode)
{
   ((CustomPickBody*)pick)->SetPickMode (mode);
}

void CustomPickBodySetMaxLinearFriction(NewtonUserJoint* pick, dFloat accel)
{
   ((CustomPickBody*)pick)->SetMaxLinearFriction(accel);
}

void CustomPickBodySetMaxAngularFriction(NewtonUserJoint* pick, dFloat alpha)
{
   ((CustomPickBody*)pick)->SetMaxAngularFriction(alpha);
}


void CustomPickBodySetTargetRotation (NewtonUserJoint* pick, dFloat* rotation)
{
   ((CustomPickBody*)pick)->SetTargetRotation (*((dQuaternion*) rotation)) ;
}

void CustomPickBodySetTargetPosit (NewtonUserJoint* pick, dFloat* posit)
{
   ((CustomPickBody*)pick)->SetTargetPosit ((*(dVector*)posit));
}

void CustomPickBodySetTargetMatrix (NewtonUserJoint* pick, dFloat* matrix)
{
   ((CustomPickBody*)pick)->SetTargetMatrix ((*(dMatrix*) matrix));
}

void CustomPickBodyGetTargetMatrix (NewtonUserJoint* pick, dFloat* matrix)
{
   dMatrix& retMatrix = (*(dMatrix*) matrix);
   retMatrix = ((CustomPickBody*)pick)->GetTargetMatrix();
}

// BEGIN k00m (Dave Gravel simple raycast world vehicle)
NewtonUserJoint *DGRaycastVehicleCreate (int maxTireCount, const dFloat* cordenateSytem, NewtonBody* carBody)
{
  return new CustomDGRayCastCar (maxTireCount, *((dMatrix*) cordenateSytem), carBody);
}

void DGRaycastVehicleAddTire (NewtonUserJoint *car, void *userData, const dFloat* localPosition, dFloat mass, dFloat radius, dFloat width, dFloat friction, dFloat suspensionLength, dFloat springConst, dFloat springDamper, int castMode)
{
  ((CustomDGRayCastCar*)car)->AddSingleSuspensionTire(userData,localPosition,mass,radius,width,friction,suspensionLength,springConst,springDamper,castMode);
}

const NewtonCollision* DGRayCarTireShape(NewtonUserJoint *car, int tireIndex)
{
  return ((CustomDGRayCastCar*)car)->GetTiresShape(tireIndex);
}

void DGRayCarGetChassisMatrixLocal(NewtonUserJoint *car, dFloat* chassisMatrix)
{
  (*(dMatrix*)chassisMatrix) = ((CustomDGRayCastCar*)car)->GetChassisMatrixLocal();
}

void DGRayCarTireMatrix(NewtonUserJoint *car, int tire, dFloat* tireMatrix)
{
  (*(dMatrix*)tireMatrix) = ((CustomDGRayCastCar*)car)->CalculateTireMatrix(tire);
}

void DGRayCarSuspensionMatrix(NewtonUserJoint *car, int tire, dFloat param, dFloat* SuspensionMatrix)
{
  (*(dMatrix*)SuspensionMatrix) = ((CustomDGRayCastCar*)car)->CalculateSuspensionMatrix(tire,param);
}

void DGRaycastVehicleSetCustomTireBrake (NewtonUserJoint *car, int index, dFloat torque)
{
  ((CustomDGRayCastCar*)car)->SetCustomTireBrake(index,torque);
}

void DGRaycastVehicleSetCustomTireTorque (NewtonUserJoint *car, int index, dFloat torque)
{
  ((CustomDGRayCastCar*)car)->SetCustomTireTorque(index,torque);
}

void DGRaycastVehicleSetCustomTireSteerAngleForce (NewtonUserJoint *car, int index, dFloat angle, dFloat turnforce)
{
  ((CustomDGRayCastCar*)car)->SetCustomTireSteerAngleForce(index,angle,turnforce);
}

dFloat DGRaycastVehicleGetSpeed(NewtonUserJoint *car)
{
  return ((CustomDGRayCastCar*)car)->GetSpeed();
}

dFloat DGRaycastVehicleGenerateTiresBrake (NewtonUserJoint *car, dFloat value)
{
  return ((CustomDGRayCastCar*)car)->GenerateTiresBrake ( value );
}

dFloat DGRaycastVehicleGenerateTiresTorque (NewtonUserJoint *car, dFloat value)
{
  return ((CustomDGRayCastCar*)car)->GenerateTiresTorque( value );
}

dFloat DGRaycastVehicleGenerateTiresSteerForce (NewtonUserJoint *car, dFloat value)
{
  return ((CustomDGRayCastCar*)car)->GenerateTiresSteerForce( value );
}

dFloat DGRaycastVehicleGenerateTiresSteerAngle (NewtonUserJoint *car, dFloat value)
{
  return ((CustomDGRayCastCar*)car)->GenerateTiresSteerAngle( value );
}

void DGRaycastVehicleSetVarTireMovePointForceFront (NewtonUserJoint *car, int index, dFloat distance)
{
  ((CustomDGRayCastCar*)car)->SetVarTireMovePointForceFront( index, distance );
}

void DGRaycastVehicleSetVarTireMovePointForceRight (NewtonUserJoint *car, int index, dFloat distance)
{
  ((CustomDGRayCastCar*)car)->SetVarTireMovePointForceRight( index, distance );
}

void DGRaycastVehicleSetVarTireMovePointForceUp (NewtonUserJoint *car, int index, dFloat distance)
{
  ((CustomDGRayCastCar*)car)->SetVarTireMovePointForceUp( index, distance );
}

void DGRaycastVehicleSetVarFixDeceleration (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarFixDeceleration( value );
}

void DGRaycastVehicleSetVarChassisRotationLimit (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarChassisRotationLimit( value );
}

void DGRaycastVehicleSetVarMaxSteerAngle (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxSteerAngle( value );
}

void DGRaycastVehicleSetVarMaxSteerRate (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxSteerRate( value );
}

void DGRaycastVehicleSetVarMaxSteerForceRate (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxSteerForceRate( value );
}

void DGRaycastVehicleSetVarMaxSteerForce (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxSteerForce( value );
}

void DGRaycastVehicleSetVarMaxSteerSpeedRestriction (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxSteerSpeedRestriction( value );
}

void DGRaycastVehicleSetVarMaxBrakeForce (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxBrakeForce( value );
}

void DGRaycastVehicleSetVarMaxTorque (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxTorque( value );
}

void DGRaycastVehicleSetVarMaxTorqueRate (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarMaxTorqueRate( value );
}

void DGRaycastVehicleSetVarEngineSteerDiv (NewtonUserJoint *car, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarEngineSteerDiv( value );
}

void DGRaycastVehicleSetVarTireSuspenssionHardLimit (NewtonUserJoint *car, int index, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarTireSuspenssionHardLimit( index, value );
}

void DGRaycastVehicleSetVarTireFriction (NewtonUserJoint *car, int index, dFloat value)
{
  ((CustomDGRayCastCar*)car)->SetVarTireFriction( index, value );
}

int DGRaycastVehicleGetVehicleOnAir(NewtonUserJoint *car)
{
  return ((CustomDGRayCastCar*)car)->GetVehicleOnAir();
}

int DGRaycastVehicleGetTireOnAir(NewtonUserJoint *car, int index)
{
  return ((CustomDGRayCastCar*)car)->GetTireOnAir( index );
}

int DGRaycastVehicleGetTiresCount(NewtonUserJoint *car)
{
  return ((CustomDGRayCastCar*)car)->GetTiresCount();
}

void DGRaycastVehicleDestroy (NewtonUserJoint *car)
{
  delete car;
}
*/

// common Joints functions
int CustomGetJointID (NewtonUserJoint *joint)
{
   return ((NewtonCustomJoint*)joint)->GetJointID ();
}

void CustomSetJointID (NewtonUserJoint *joint, int rttI)
{
   ((NewtonCustomJoint*)joint)->SetJointID(rttI);
}

const NewtonBody* CustomGetBody0 (NewtonUserJoint *joint)
{
   return ((NewtonCustomJoint*)joint)->GetBody0();
}

const NewtonBody* CustomGetBody1 (NewtonUserJoint *joint)
{
   return ((NewtonCustomJoint*)joint)->GetBody1();
}

int CustomGetBodiesCollisionState (NewtonUserJoint *joint)
{
   return ((NewtonCustomJoint*)joint)->GetBodiesCollisionState();
}

void CustomSetBodiesCollisionState (NewtonUserJoint *joint, int state)
{
   ((NewtonCustomJoint*)joint)->SetBodiesCollisionState(state);
}

void CustomDestroyJoint(NewtonUserJoint *joint)
{
   delete ((NewtonCustomJoint*)joint);
}



just replace thsoe fiel with these new one and you can use teh C Interface including only the JointLibary.h
I am making a series ot tutorials that using teh C inteface and it will clear all erorr.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby FlemMonk » Tue Jun 30, 2009 12:06 pm

Look forward to them!
FlemMonk
 
Posts: 14
Joined: Tue May 26, 2009 5:18 pm

Re: Newton 2.0x Archemedia Open Beta

Postby redhead_cz » Wed Jul 01, 2009 12:56 pm

Hi,
I tried to upgrade to newton 2.0, compile and runs fine, but physics are somehow bad. Simple box shooting against wall behaves very strange. It is used in my application which was running fine in newton 1.5x (or so), now it can be seen that there is some collision, box collides against wall but somehow it gets through it.

Other example - my player (ellipsoid) which tries to go from flat to angled ramp goes through the ramp, when I stop player body very slowly climbs to "match" the ramp height.
Cant go on stairs either.

What can cause such an errors? Code is identical to 1.5x version, but modified to current 2.0 version.

(I am using MogreNewt, port of Newton for (M)ogre rendering system, I was asking on forum there and they recomended to go here)

thanks for any help..
redhead_cz
 
Posts: 2
Joined: Wed Jul 01, 2009 12:50 pm

Re: Newton 2.0x Archemedia Open Beta

Postby JernejL » Wed Jul 01, 2009 1:17 pm

Posting a video of the problem would be a good idea, it might be due to improper use of setforce / setvelocity in previous versions or similar stuff, if you can make a comparison video it would be much help in figuring out the problem.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Wed Jul 01, 2009 2:31 pm

redhead_cz wrote:What can cause such an errors? Code is identical to 1.5x version, but modified to current 2.0 version.

That might be teh sort of eth error, there are some subtle diffrenmces bewteen 1.5 and 2.0
liek Delfi say can you post a video?

Are you using the Player controller? or are you using you own?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby FlemMonk » Thu Jul 02, 2009 2:52 am

Sorry Julio, I didn't understand what you mean by 'Fix' I can only assume that you thought I spotted a issue with the JointLibrary when infact I hadn't and you may of found one and posted the resulting CPP/H Files?

Any news yet on those examples/tutorials?
FlemMonk
 
Posts: 14
Joined: Tue May 26, 2009 5:18 pm

Re: Newton 2.0x Archemedia Open Beta

Postby redhead_cz » Thu Jul 02, 2009 8:23 am

Delfi wrote:Posting a video of the problem would be a good idea


I will try, I had difficulties with FPS of the video before, it was almost unviewable. I will try to run it on better comp, but there are some other errors in rendering though.
redhead_cz
 
Posts: 2
Joined: Wed Jul 01, 2009 12:50 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Thu Jul 02, 2009 1:13 pm

FlemMonk wrote:Any news yet on those examples/tutorials?


I am working on them; we just posted the very first one for Newton 2.0 in the wiki.
It only have the text yet as I am perfecting it still.

You may no believe it but it takes a lot of work to make tutorial from scratch writing everything, the graphics, the control, and the physics.
I am trying to make them as generic as possible, and yet as focus in one issue as I can possible makes them, can so that everybody understands them.

I could have used a Graphics engine to get headway, but if I do that it would not be fair to user of other engines.
We are trying to separate all of the Graphics stuff in a framework that people can check out if they want but they will not have to
study in order to get the physics part of the tutorial which is the goal of the project.

I am starting at the Basics and moving to more advanced functionality, bu it take form tow to tree day to write them and have the review by Delfi.

You can go to the Wiki and read the first one called Tutorial_101_GetingStarted,
It will be nice if you give us some feedback as to how default they are and if we have something you would like to be corrected.
We will post the next one sometime today or tomorrow, and we will continues posit more every two or three days, until we cover most for the stuff.
We will have Joints, materials, Player controllers, Raycast and multibody cars, Rag dolls, Using different coordinate systems and different Scales
between graphics and Physics and many more.
Plus I will keep making special ones for people having problems with special engine functionality.

Other users can contribute too, but that will be after we get the very bacics ones up.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby JernejL » Thu Jul 02, 2009 4:54 pm

The tutorials are here, the new newton 2.0 ones are at top:

http://newtondynamics.com/wiki/index.ph ... =Tutorials
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 30 guests