Constrain Rotations

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Constrain Rotations

Postby Lax » Wed May 13, 2020 12:22 pm

Hi Julio,

I integrated your nice solution of basic player controller, thanks for the example :)

But I'm now a bit confused, as the internal implementation of
Code: Select all
dCustomPlayerController
uses also Velocity for movement. But I thought your advice was, not to use velocity but working with forces!? As velocity can make physics unstable. Could you explain a little bit, how the
Code: Select all
dCustomPlayerController
is working behind the scenes?

Thanks in advance.

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Lax » Thu May 14, 2020 3:42 pm

Hi Julio,

I also have an request. I extended the function CreateController with a userData pointer:
Code: Select all
CUSTOM_JOINTS_API virtual dCustomPlayerController* CreateController(const dMatrix& location, const dMatrix& localAxis, dFloat mass, dFloat radius, dFloat height, dFloat stepHeight, void* const userData);

dCustomPlayerController* dCustomPlayerControllerManager::CreateController(const dMatrix& location, const dMatrix& localAxis, dFloat mass, dFloat radius, dFloat height, dFloat stepHeight, void* const userData)
{
...
controller.m_userData = userData;
}


I did the same, as it is done in dCustomTriggerManager, because I need to react on ProccessContact, FrictionContact via callback.

Would It be possible for you, to extend as I did in the newest newton version?

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Julio Jerez » Sat May 16, 2020 10:57 am

Lax wrote:Hi Julio,

I integrated your nice solution of basic player controller, thanks for the example :)

But I'm now a bit confused, as the internal implementation of
Code: Select all
dCustomPlayerController
uses also Velocity for movement. But I thought your advice was, not to use velocity but working with forces!? As velocity can make physics unstable.

OI said not to use velocity for dynamic bodies, player controller is a kinematic body.
kinematic bodies are rigid bodies that do not part of the dynamic resolution, they are only part of the collision



Lax wrote:Could you explain a little bit, how the
Code: Select all
dCustomPlayerController
is working behind the scenes?Lax


like I said the play is a kinematic body. The have the own impulse solver the calculate the motion of the player base if the velocity impulse from the player. they partially obey the secund law of motion.

basically in each step the collect the contact wit the environment and put then in the solver to determine whi wna nee to be clip and which one do no, then teh move to teh first collision.
if the time step is onle a fraction teh repeat the process until teh maximum allow of sub steps is complete of until the timestep is completed. This is the primary reason why player can no be rigid body, teh onel execute one step.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Constrain Rotations

Postby Julio Jerez » Sat May 16, 2020 10:59 am

I did the same, as it is done in dCustomTriggerManager, because I need to react on ProccessContact, FrictionContact via callback.

Would It be possible for you, to extend as I did in the newest newton version?

doesn't the controller have a funtion to set the user data?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Constrain Rotations

Postby Lax » Sun May 17, 2020 4:48 am

Hi Julio,

ok thanks for your explanation. Now I have all pieces together :).

Code: Select all
doesn't the controller have a funtion top set the user data?


No, the controller internally has the property userData, but the parameter is missing in the constructor and hence never set.

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Julio Jerez » Sun May 17, 2020 12:55 pm

Oh I see the vehicle class is this class dPlayerController: public dVehicle
and is has a use data member.
that's a legacy member I will removed it.

if you look at the base class class dVehicle: public dVehicleNode
and the base of that base : class dVehicleNode: public dCustomAlloc

dVehicleNode has two members
void* GetUserData() const {return m_usedData;}
void SetUserData(void* const userData) {m_usedData = userData;}
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Constrain Rotations

Postby Lax » Thu May 21, 2020 7:39 am

if you look at the base class class dVehicle: public dVehicleNode
and the base of that base : class dVehicleNode: public dCustomAlloc


Ok thanks for the information.

I have another question concerning PlayerController:

The orientation is only correct if I do not rotate my player. Like in the video: My player's origin direction is 0,0,1 and I orientated the player by 90 degrees. I feed the player controller with those values. But no matter what I do. As soon as 'ApplyMove' and set 'SetHeadingAngle' (initially with 0) the player will rotate back.
I orientated on the BasicPlayerController demo, but for me it seems, that something is wrong with the matrix.

Believe me, I tried several options in feeding the player controller, but it does not matter. Only the heading is controlling the orientation of the player.

Is there something wrong in 'CreateController' function?

http://www.lukas-kalinowski.com/Homepage/wp-content/uploads/PlayerControllerOrientation.mp4
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Lax » Tue Jun 02, 2020 10:34 am

Hi,

maybe my last post was to confusing. So I try point out my problem via the Basic player controller newton demo. When I set the start orientation from of x-axis to z-axis:
Code: Select all
localAxis[1] = dVector (0.0, 0.0f, 1.0f, 0.0f);

and start the demo, the player will move forward by pressing the key d instead of w.

I would think, It should not matter how the player is orientated at the beginning?

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Julio Jerez » Tue Jun 02, 2020 11:37 am

I see now.
In general making play capsule controller rotate has been a subject of debate amount game play programmers. some thing the control should rotate the controller and some don't.
I am on that camp that thing it should not rotate, but you are correct the controller should be flexible to handle bot cases.

I will add that option.

My pc is supposed to be here tomorrow, when I get it I will do that.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Constrain Rotations

Postby Lax » Tue Jun 02, 2020 11:57 am

Hi julio,

ok thanks!

My pc is supposed to be here tomorrow, when I get it I will do that.

I hope, everything will be working!

Just another question concerning kinematic bodies: Is it possible to e.g. create a hinge joint between one kinematic and a dynamic body?

I want to create a partial ragdoll player controller. The root is a kinematic body and the right arm I want to connect via joints for a more advanced fighting system.

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Lax » Tue Jun 23, 2020 3:36 am

Hi Julio,

I hope your new pc is ready!
Is there any progress concerning this topic?

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Lax » Fri Jul 17, 2020 4:43 am

Hi julio,

any news on this topic?

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Lax » Mon Oct 05, 2020 10:49 am

Hi julio,

I know, you are really busy, and I'm afraid to ask. But could you fix the origin orientation issue for the player controller? It would ease the usage a lot.

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Constrain Rotations

Postby Julio Jerez » Mon Oct 05, 2020 11:20 am

Oh I am sorry, I kept saying I was going to fix that and never did, I will do this week, I promise.
sorry about that delay.

can you remind me again what the original problem is? or point to the post?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Constrain Rotations

Postby Lax » Mon Oct 05, 2020 2:22 pm

never mind :)

Post:
I have another question concerning PlayerController:

The orientation is only correct if I do not rotate my player. Like in the video: My player's origin direction is 0,0,1 and I orientated the player by 90 degrees. I feed the player controller with those values. But no matter what I do. As soon as 'ApplyMove' and set 'SetHeadingAngle' (initially with 0) the player will rotate back.
I orientated on the BasicPlayerController demo, but for me it seems, that something is wrong with the matrix.

Believe me, I tried several options in feeding the player controller, but it does not matter. Only the heading is controlling the orientation of the player.

Is there something wrong in 'CreateController' function?

http://www.lukas-kalinowski.com/Homepag ... tation.mp4

maybe my last post was to confusing. So I try point out my problem via the Basic player controller newton demo. When I set the start orientation from of x-axis to z-axis:
CODE: SELECT ALL
localAxis[1] = dVector (0.0, 0.0f, 1.0f, 0.0f);

and start the demo, the player will move forward by pressing the key d instead of w.

I would think, It should not matter how the player is orientated at the beginning?

I see now.
In general making play capsule controller rotate has been a subject of debate amount game play programmers. some thing the control should rotate the controller and some don't.
I am on that camp that thing it should not rotate, but you are correct the controller should be flexible to handle bot cases.

I will add that option.

My pc is supposed to be here tomorrow, when I get it I will do that.
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 40 guests

cron