A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by PJani » Wed Feb 17, 2010 11:57 am
few years ago i was testing recursion speed with fibonachi numbers on linux and windows. Linux 64bit was faster than 32bit and windows for some reason.
I think linux kernel is optimised for such heavy operations. Maybe newton would run faster on Windows Server versions, but this is just hintch.
If 32bit executes on 64bit processor, processor needs to switch to 32bit mode. Maybe on native 32bit processor would newton preform faster on 32bit os.

| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
-

PJani
-
- Posts: 448
- Joined: Mon Feb 02, 2009 7:18 pm
- Location: Slovenia
by LukasBanana » Sat Feb 20, 2010 7:22 am
So, now I can compile my programs using the JointLibrary.
But for now I'm trying to understand how to use the CustomPlayerController class.
I could not found any tutorial where the functions are explained.
I copied a small code from the NewtonDemo:
- Code: Select all
dMatrix Mat(GetIdentityMatrix());
Mat.m_front = dVector (0.0f, 1.0f, 0.0f, 0.0f); // up direction in global Space
Mat.m_up = dVector (1.0f, 0.0f, 0.0f, 0.0f); // front direction in global Space
Mat.m_right = Mat.m_front * Mat.m_up; // strafing direction in global Space
PlayerController = new CustomPlayerController(Mat, figure->Body, 0.7f / 1.9f, 1.0f / 64.0f);
But my player just lies on the floor. Do I only have to use the SetVelocity function for the playercontroller?
"PlayerController->SetVelocity(left/right, up/down etc.)"
-

LukasBanana
-
- Posts: 35
- Joined: Mon Jul 27, 2009 11:55 am
- Location: Germany
-
by LukasBanana » Sat Feb 20, 2010 7:54 am
Additional question:
Is it possible to set the PlayerController's UpVector so, that your player can walk around a planet (like in
SuperMarioGalaxy 
)
So when the player is at the top of the sphere the playercontroller's upvector is (0, 1, 0) and when he is at the bottom it is (0, -1, 0)
Currently the playercontroller on how I implemented it looks very strange. An the player lies on the bottom, so the upvector must be wrong but I tried some combinations of the matrix / up, right, side vectors.
Can anyone tell me how to set the upvector correct?
Here is a small code part:
- Code: Select all
dMatrix Mat(GetIdentityMatrix());
Mat.m_front = dVector (0.0f, 1.0f, 0.0f, 0.0f); // up direction in global Space
Mat.m_up = dVector (0.0f, 0.0f, 1.0f, 0.0f); // front direction in global Space
Mat.m_right = dVector (1.0f, 0.0f, 0.0f, 0.0f); // strafing direction in global Space
PlayerController = new CustomPlayerController(Mat, figure->Body, 0.7f / 1.9f, 1.0f / 64.0f);
PlayerController->SetMaxSlope(30.0f * 3.1416f / 180.0f);
And what does the "SetMaxSlope" function do?
-

LukasBanana
-
- Posts: 35
- Joined: Mon Jul 27, 2009 11:55 am
- Location: Germany
-
by Julio Jerez » Sat Feb 20, 2010 8:11 am
All of that is posible, but you need to get it running on a terrain with a fix vertical gravity first.
did you get it running by setting the velocity?
if not, can you post a picture of how it looks? a youtube video would be better.
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by LukasBanana » Sat Feb 20, 2010 8:40 am
I made a small video (AVI movie in ZIP file)
(Video is made very bad but I was just using a Java programm to capture the screen.)
In the short video I am using the arrow keys to move the capsule.
You'll see how the translation of this object looks strange.
Here is the download link:
http://www.hlc-games.de/projects/softpixelengine/movie.zip
-

LukasBanana
-
- Posts: 35
- Joined: Mon Jul 27, 2009 11:55 am
- Location: Germany
-
by Julio Jerez » Sat Feb 20, 2010 10:40 am
Oh I see, you are making the player rigid body using a capsule alignetd to the default oreintation which in newton is the x axis.
if you look at function
NewtonBody* CreatePlayBody (NewtonWorld* world, SceneManager* scene, dFloat mass, const dMatrix& srcMatrix, const dVector& size, int matrixlId);
from the SDK demos, you can see that the capsule is rotated by 90 degree around the z axis
- Code: Select all
...
...
// create the collision
dMatrix location (dRollMatrix(-3.1416f * 0.5f));
collision = NewtonCreateCapsule (world, size.m_y, size.m_x, 0, &location[0][0]);
try that, see if it makes it better
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by LukasBanana » Sat Feb 20, 2010 11:20 am
Ok, now it looks much better. But how can I configure the height for that when the player automatically go upper.
I know it is used for stairs but currenlty in my program the player jumps up of a cube which is a little bit to height.
-

LukasBanana
-
- Posts: 35
- Joined: Mon Jul 27, 2009 11:55 am
- Location: Germany
-
by Julio Jerez » Sat Feb 20, 2010 11:28 am
when to create the player joint, it has parameter to set the stair high and the max ram it can climb. in function
MyPlayerController (const dMatrix& globalFrame, NewtonBody* player, dFloat stairStepFactor, dFloat cushion)
stairStepFactor is a fration of teh size of eth collision shape,
if for example the capsule high is 1.8 meter, and you make wnat the star step to be say 0.3 meter you can set
stairStepFactor = desired step / play hight = 0.3 / 1.8
if you implement the debug display for the player joint you will see how the collision shapes are set.
look in the SDK demo Character controller so you can see hwo it is implemented, it is basically rendin the collision shapes the joint uses for operation.
you sodul eb abou to extrat what you nee to make it work in you game.
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by LukasBanana » Sat Feb 20, 2010 11:37 am
Ah ok, I can see two shapes and I think I found the functions:
GetStairStepShape and GetSensorShape
Do I only have to transform these NewtonCollision objects to the size I want?
-

LukasBanana
-
- Posts: 35
- Joined: Mon Jul 27, 2009 11:55 am
- Location: Germany
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 153 guests