Scale messing with collision

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Scale messing with collision

Postby lewd » Thu May 07, 2020 1:14 pm

So I've got a bunch of simple primitives in a scene, and I'm throwing scaled versions of those primitives at them. I scale them with SetCollisionScale and give them an initial velocity with SetVelocity.

The scaled objects appear to have a size of a single point, until their first collision. They miss other objects around the edges and only collide with the center. After one collision, they start behaving normally.

This only happens when scale is being messed with. Projectiles with a scale of 1 do not miss their collisions. Is this a bug or is there more to scaling objects than just calling this one function?
Attachments
full.gif
full.gif (122.9 KiB) Viewed 8234 times
half.gif
half.gif (45.81 KiB) Viewed 8234 times
lewd
 
Posts: 5
Joined: Wed Apr 29, 2020 5:18 am

Re: Scale messing with collision

Postby JernejL » Fri May 08, 2020 3:46 am

SetCollisionScale should work, as long as the collision object is not shared among multiple bodies and another object is overriding scale, can you check that?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Scale messing with collision

Postby Julio Jerez » Fri May 08, 2020 10:24 pm

not, set scale work with share collision. collision are instances.

my guess is that you collsion shape are off. try implementing debug display,
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scale messing with collision

Postby lewd » Wed May 20, 2020 10:29 am

What kind of debug display? I do not see an API for this anywhere.
I can only use extern C functions from the library.
lewd
 
Posts: 5
Joined: Wed Apr 29, 2020 5:18 am

Re: Scale messing with collision

Postby Julio Jerez » Wed May 20, 2020 11:40 pm

the engine does not have any rendering function, instead is have low level functions that you can call to do what you want. you can see many example in file ..\applications\demosSandbox\sdkDemos\toolBox\DebugDisplay.h

look for function
void DebugRenderWorldCollision (const NewtonWorld* const world, DEBUG_DRAW_MODE mode)

if you play the demos, there is a drop down menu, that you can select to show the collision shapes.
from there you can see how the debug display is impediment.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scale messing with collision

Postby lewd » Thu May 21, 2020 4:36 pm

Oh okay, I can reimplement that on my side.
lewd
 
Posts: 5
Joined: Wed Apr 29, 2020 5:18 am

Re: Scale messing with collision

Postby lewd » Thu May 21, 2020 5:31 pm

Well, this is interesting. The colliders are scaled twice, and this is what's causing them to miss collisions the first time. But after that first collision, the scale is corrected, while debug still displays a smaller collider.
Bug?
Attachments
wire.png
wire.png (40.75 KiB) Viewed 8154 times
lewd
 
Posts: 5
Joined: Wed Apr 29, 2020 5:18 am

Re: Scale messing with collision

Postby Dave Gravel » Thu May 21, 2020 10:50 pm

Hi lewd,
Do you use scaled matrix somewhere in newton ?
Maybe i'm wrong but it look like you use a scaled matrix and with newton you need to use normal matrix without scale.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 48 guests