Petition (Suggestion/Request) for Scale

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Do you think the ability to scale a collision or body object during runtime should be available?

Yes
4
67%
No
2
33%
 
Total votes : 6

Petition (Suggestion/Request) for Scale

Postby Van » Sun Nov 22, 2009 8:05 am

Suggestion: add new functions:

To be applied to an entire NewtonBody
NewtonBodySetScale( NewtonBody nBody, dFloat* Vector3[0] )
NewtonBodyGetScale()

To be applied to be applied to a NewtonCollision
NewtonCollisionSetScale( NewtonBody nBody, dFloat* Vector3[0] )
NewtonCollisionGetScale()

It would be nice to be able to set a scale factor to a NewtonBody and NewtonCollision. This is so a body or collision object may be scaled during runtime. The scale should default to (1, 1, 1). All zeros would be invalid therefore the library should probably clamp it to 0.001 or something. One would also be able to serial and deserialize a collision object and scale it to the desired size. We believe having a scale factor would be a valuable asset the newton library. Of coarse the internal arithmetic would have to include Scale but this would really add a lot of power to Newton. This should be relatively minor change as it's just a multiplication factor being added to the arithmetic.

Case Scenario:
In our application we have asteroids. All our asteroids have a pre-defined mesh. What we do is scale the asteroid based on their contents. That is, the more ore an asteroid has the larger the asteroid appears (i.e. we "scale" it). If an asteroid has 100 units of ore, then the asteroid is scaled to (100, 100, 100). As the asteroid is mined and ore is removed by the player, the asteroid shrinks by the number of units removed. The scale is reduced and thus the asteroid appears to "shrink". This works fine in the rendering scene manager - the SceneNode is scaled accordingly. However, this presents a problem in Newton. There is no scale factor so we have to delete the NewtonBody and recreate it. We use the TreeCollision for asteroids so there is some significant overhead to tearing down and recreating this NewtonBody - enough to cause "flicker" in the game.

Please take into account that we may have two or more asteroids using the same model (mesh) in the scene but have totally different scales. Each one does get their own NewtonBody.
Van
 
Posts: 17
Joined: Mon Nov 08, 2004 12:36 am

Re: Petition (Suggestion/Request) for Scale

Postby Julio Jerez » Sun Nov 22, 2009 8:35 am

doesn't the collision Scale modifier does that.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Petition (Suggestion/Request) for Scale

Postby JernejL » Sun Nov 22, 2009 11:54 am

Scaling is already availible on convex hulls with a convex hull modifier.. and they would probably fit your asteroids easily.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Petition (Suggestion/Request) for Scale

Postby agi_shi » Sun Nov 22, 2009 12:31 pm

Julio Jerez wrote:doesn't the collision Scale modifier does that.

From what I can tell, the OP wants scaling on a tree collision, which can't use the convex hull modifier.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Petition (Suggestion/Request) for Scale

Postby Van » Sun Nov 22, 2009 12:45 pm

Julio Jerez wrote:doesn't the collision Scale modifier does that.


Delfi wrote:Scaling is already availible on convex hulls with a convex hull modifier.. and they would probably fit your asteroids easily.


No. The collision (hull) modifier does not work because we use TREE collision for these objects. The convex hull is to granular. We need a tight collision to perform the effects we are doing. Also, the asteroids are oddly shaped and thus produces a poor convex hull collision for these objects. We also attach "rewards" to certain faces and if the user strikes a "reward" face with their mining beam then they get an extra reward.
Van
 
Posts: 17
Joined: Mon Nov 08, 2004 12:36 am

Re: Petition (Suggestion/Request) for Scale

Postby Carli » Sun Nov 22, 2009 4:00 pm

....or allow storing the scale factor into the matrix (and normalize matrix calculation results)
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Petition (Suggestion/Request) for Scale

Postby Leadwerks » Sun Jan 31, 2010 2:14 am

+1 for this. I would like to be able to scale trees I place in the scene (tree objects, I mean, not collision trees). Also, the convex hull modifier is on a per-collision basis, which is wasteful if you have multiple bodies using the same collision shape, unless I misunderstand how the instancing works.

This is much more important to me than hardware acceleration or any advanced features.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Petition (Suggestion/Request) for Scale

Postby JernejL » Sun Jan 31, 2010 10:04 am

I am guessing the reason you cannot scale any object is, that efficiency decreases and complexity of collision detection algorythms increases a lot, it is probably also not a very common feature in physics engine because of this reason.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Petition (Suggestion/Request) for Scale

Postby Julio Jerez » Sun Jan 31, 2010 11:14 am

It is too late for including the feature in 2.00
this is feature that is best leaving for newton 3.0

as simple a scale seems to the end user is translate to a very big architertual change in the engine size.

to give an example say we have teh simples collsion shape whin I beleiev is the sphere.

becaus enetwon catche spheres I can no add a scale to the sphere data structure, I will have to do it eithe at on eth Body tha carry teh collision (wich seem teh base place to do it)
ot I will have to create a Collison Instace which is a structure with the same functionality of a collision but all if has is dereference to eth actual shape it carry,
the secund solution will be the most corrent way by this is a very big engine change.

I am in the proccess of change teh face of the demos, and addin teh Collda as the Netwon file format,
when I finish with that I will see if adding teh collision instace method is feasible, in fact tehis is almos teh same that teh modifier does but is a much simpel way becaus the scale is generic.

if it is no too much work I will added.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 159 guests