different behaviors in unity

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

different behaviors in unity

Postby blackbird_dream » Thu Nov 30, 2017 10:56 am

Hi,
I've build a small demo of a cube falling down and a reaction force added opposite to the fall and 2nd order with damping : (F=a*deflection+b*deflection^2)-c*velocity
One demo is built with Newton 1.5 in a delphi code
and the second one in unity.
In unity the behavior looks weird as the oscillations never stop or last longer.
I've uploaded the 2 exe, unity script and delphi sources here :
http://dl.free.fr/hjKHz66KN
Thks

NB : In particular if I shake the window with mouse it makes the cube oscillate :)
Last edited by blackbird_dream on Thu Nov 30, 2017 11:47 am, edited 2 times in total.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: different behaviors in unity

Postby blackbird_dream » Thu Nov 30, 2017 11:19 am

Is it due to the fact that I use transform.position to update the position of the gameobject and not the position of the corresponding newtonbody in the OnApplyForceAndTorque event?
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: different behaviors in unity

Postby Julio Jerez » Thu Nov 30, 2017 12:06 pm

I would guess that you need to use the that actual position of the rigid body, no the visual position wich is interpolated between the current frame and one frame into the future.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: different behaviors in unity

Postby blackbird_dream » Thu Nov 30, 2017 1:13 pm

Thks for your reply.
that's what I supposed too.
but there is no position property in the plugin yet I believe. Maybe sweenie can add it as it should be similar than velocity if he agrees and has got enough time.
The other issue may arise with the raycast I m currently usîng.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: different behaviors in unity

Postby Sweenie » Thu Nov 30, 2017 3:40 pm

Hi.

I've added properties for body position and rotation which fetch the non interpolated values.
Try if that works better.
I only had time to implement the getters so these properties are read only for now.
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: different behaviors in unity

Postby Julio Jerez » Thu Nov 30, 2017 3:42 pm

do you mean that the unit script expose the velocity of a rigid body but not the position?
That a huge over side.

Is a long time I have no sync to the plugin because I was focus on getting 3.14 ready for final release before the year is out.

There are some special functionality I want to add, but I can see that there is still lot of basic functionality missing.
I estimate that in about tow weeks I will try another push to the plugin in to make more complete.

Mean time maybe Sweenie can check that out add that, which should be quite trivial.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: different behaviors in unity

Postby Julio Jerez » Thu Nov 30, 2017 3:44 pm

oh my post was toow late.

Het sweetie, I am getting ready for the final stable release of 2.14
after that Maybe we can work again on another Push to bring the plugin more up to date?
what do you say?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: different behaviors in unity

Postby blackbird_dream » Thu Nov 30, 2017 4:05 pm

Ok thks
I ll try tomorrow.
here is the link to the video of the instability
https://youtu.be/mRTZzh8OTOo
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: different behaviors in unity

Postby blackbird_dream » Fri Dec 01, 2017 6:25 am

ok Thks again Sweenie,
I updated my build and it solved the issue.
I suspect now, I'll get the same troubles with my Unityraycast function. I'm about to test it.
If you plan with Julio to push a new release, would it be abusive to ask for embedding the Newton Raycast function ?
Thnks beforehand.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: different behaviors in unity

Postby Sweenie » Fri Dec 01, 2017 7:39 am

Raycasting is a fundamental thing to have so yes, absolutely, this must be added.
There was another user asking for this earlier as well but the development of the plugin has been a bit slow due to other projects and stuff.

@Julio.
Yes, lets give it a go.
I'm eager to get the vehicle implemented and also the inverse dynamics stuff you are working on now. :)

@Blackbird
I'm also curious to see what you are working on, unless it's a secret project of course. :?
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: different behaviors in unity

Postby blackbird_dream » Fri Dec 01, 2017 1:41 pm

I ll send it to you when it s finished.
thks for your great effort it's not vain.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 13 guests

cron