Monday, March 30, 2009

Papervision 3D + APE Physics Engine, Mouse Forces tweaks.

After some diaper changes, a few baby bottles and a couple of trips to the day care, I was able to implement some needed logic to the spheres model. Here's what I added/changed this time around:

- Calculated the mouse speed and added it into the calculations of the "onOver" force. In this version, the force generated at the collision between mouse and sphere, is proportional to the instantaneous mouse speed at that moment (an the mass of the sphere as well, but this is taken care of by physics engine (APE).

- Played around with various parameters so that the overall movement ends up like I wanted it to.
APEngine.init(1/3);
APEngine.damping=0.98;
CircleParticle.mass = 3
CircleParticle.elasticity=0.4 (this one might be too high)
CircleParticle.friction=0.1
CircleParticle.multisample = 4 (might have to reduce this for performance)
The multisample value is the amount of times the engine checks for collision in each step of the engine.

- Added calculations to reduce the magnitude of the resulting mouse collision velocity vector if the sphere is already moving in the same direction as the mouse. If not, every mouse collision would generate a force as if the sphere was static which results in a bigger force.

Here is the result, view it full screen here for a better experience:





Thanks Axel Bunge, Sebastián Pisa, Esteban Rodriguez, Cesar Cintron & Facundo Gamallo for the feedback.

1 comment:

  1. Beyond their promotions, we’ll go in-depth to discuss MyBookie’s on line casino and sportsbook offerings earlier 코인카지노 than diving headfirst into their giant collection of fantastic customer reviews. 200CASH – Receive 10% of your deposit again a lot as} $200 whenever you use this bonus code. It’s better to get acquainted with a listing to keep away from disappointment. I take a fundamentals-based method to worth investing.I disagree with the common false impression held by many investors that low quantity of} shares must be cheap.

    ReplyDelete