NewtonCharacterController

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonCharacterController

Postby pHySiQuE » Wed Jul 04, 2012 4:21 pm

As a thank you to Julio and the community here, I am making my Newton character controller open-source.

Features:
  • Instant stair-stepping with no loss of speed.
  • Stand still on sloped ground, with a maximum slope angle.
  • Crouch (with collision check when standing up).
  • Push and be pushed by physics bodies.
  • Be carried by objects you're standing on.
  • Movement is fast and responsive!
I converted my code to C++ and Newton 3, and it's almost ready to use. Here are the commands:
Code: Select all
NewtonCharacterController* NewtonCharacterControllerCreate(NewtonCharacterController* charactercontroller, float height=1.8, float radius=0.5, float stepheight=0.5, float crouchheight=1.2)
void NewtonCharacterControllerSetInput(NewtonCharacterController* charactercontroller, float angle, float move, float strafe, float jump, bool crouch)
bool NewtonCharacterControllerGetAirborne(NewtonCharacterController* charactercontroller)
bool NewtonCharacterControllerGetCrouched(NewtonCharacterController* charactercontroller)
void NewtonCharacterControllerUpdate(NewtonCharacterController* charactercontroller)

There is a problem with NewtonWorldConvexCast() in Newton 3. Below is a debuggable demo showing the problem. "RayCast.debug.exe" uses five raycasts to detect the ground. "ConvexCast.debug.exe" uses a convex cast, which is better, but it produces a crash:
http://www.leadwerks.com/post/playertest.zip

Controls:
  • Arrow keys - move
  • Space - jump
  • C - crouch
  • WASD - move camera
Last edited by pHySiQuE on Wed Jul 04, 2012 5:12 pm, edited 1 time in total.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: NewtonCharacterController

Postby belfegor » Wed Jul 04, 2012 4:49 pm

Can you provide release builds? It fails to start for me.
What about src? :mrgreen:

Thank you in advance.
User avatar
belfegor
 
Posts: 53
Joined: Mon Sep 18, 2006 4:42 pm
Location: Serbia

Re: NewtonCharacterController

Postby Julio Jerez » Wed Jul 04, 2012 5:20 pm

do I have to do something special to play it? when I run both ext I get a black screen, and if I click I get some asserts.

I like to see hwo it behaves, if it good, an I am sure it is, I can integrated as one option in teh joint library. but I can not play it.
I can also use to fi xthe bug in teh convex cast routine.
I convex cast is more expensive that a ray cast but it is not more expensive tha 5 raycast, and also should be more reliable
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCharacterController

Postby pHySiQuE » Wed Jul 04, 2012 7:44 pm

You have to extract all files to run the program. RayCast.Debug.exe will run, the other will not.

You need a real video card, not an integrated Intel thing.

I convex cast is more expensive that a ray cast but it is not more expensive tha 5 raycast, and also should be more reliable

My old character controller using Newton 2 could switch between convex and ray casting methods, too. Convex casting is much better.

I like to see hwo it behaves, if it good, an I am sure it is, I can integrated as one option in teh joint library. but I can not play it.

I think that will actually work. The shape does not have to be a cylinder, and with the new collision scaling commands, even crouching can work with an arbitrary collision shape.

What about src?

I will release the source once the convex casting is working and I fix a few small things.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: NewtonCharacterController

Postby Julio Jerez » Wed Jul 04, 2012 8:46 pm

extract the file form where? ther are not oteh archive file on that package?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCharacterController

Postby pHySiQuE » Wed Jul 04, 2012 9:02 pm

I mean extract the whole RAR file. Don't just open it in WinRar and double-click the EXE. But you probably know that.

What graphics card do you have?
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest