Share with us how are you using the powerrrr of the force
Moderator: Alain
by Julio Jerez » Tue Sep 30, 2008 6:27 pm
ho jo jo jo joww,
the powaaaa of teh force srate to shine in the.
you are that very first show and actual app in teh iphione device, an dI di dn no even test it te hliob
,
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Dave Gravel » Tue Sep 30, 2008 8:22 pm
Nice and good first app idea.
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by Yezide » Wed Oct 01, 2008 3:21 am
Cool! Now I wanna buy an iphone and make some demos for it
-
Yezide
-
- Posts: 173
- Joined: Tue Oct 18, 2005 4:31 am
by brianhammond » Wed Oct 01, 2008 2:24 pm
Cool, I originally got Julio to make the iPhone build but my app idea is fairly saturated in the app store market (billiards) at the moment. Sure, they all * but I moved on to a different idea that does not use Newton (yet).
Anything you'd like to add regarding problems getting Newton up on the iPhone from the original thread?
Looks great. So you just do a low pass filter on the accelerometer to get the gravity vector relative to the device and then use that in your callback in Newton. Nice and simple I like it.
-
brianhammond
-
- Posts: 14
- Joined: Thu Sep 06, 2007 7:59 pm
by JernejL » Wed Oct 01, 2008 3:06 pm
Some collision responses in the video there look as if your inertial values or body masses are not set properly.
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Dave Gravel » Wed Oct 01, 2008 3:13 pm
by Delfi on Wed Oct 01, 2008 2:06 pm
Some collision responses in the video there look as if your inertial values or body masses are not set properly.
I'm not 100% sure but I think it happening because the dice's is all times under a force controled.
Maybe the setup is not 100% perfect close to point force 0,0,0
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by Julio Jerez » Wed Oct 01, 2008 4:35 pm
It looks to me liek he is convertion teh matroces to euler angle an dteh is a but some where in teh convetion.
Am I correct on assuming that?
It is possible to use the matrices passed by the enigne directly?
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Caleb Cannon » Wed Oct 01, 2008 6:00 pm
It looks to me liek he is convertion teh matroces to euler angle an dteh is a but some where in teh convetion.
Am I correct on assuming that?
It is possible to use the matrices passed by the enigne directly?
I'm passing the matrices to OpenGL directly
- Code: Select all
dMatrix m;
NewtonBodyGetMatrix(objects[i].body, &m[0][0]);
glMultMatrixf(&m[0][0]);
The moments of inertia are wrong for some objects. I'm using a cube moment for everything and it isn't scaled to the objects mass, e.g., NewtonBodySetMassMatrix(body, 1.0f, 1.0f/6.0f, 1.0f/6.0f, 1.0f/6.0f);
Another thing you guys might be noticing is that force isn't always aligned with the coordinate planes. The gravity vector in the video is always pointing at my feet and a lot of weird movements are actually the objects colliding with the 6 walls containing the scene. This was super easy to pull off with the iPhone.
- Code: Select all
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
float dt = [NSDate timeIntervalSinceReferenceDate] - lastAccelTime;
lastAccelTime = [NSDate timeIntervalSinceReferenceDate];
float kLowPassFilterFactor = 0.1;
float kHighPassFilterFactor = 0.1;
// Use a basic low-pass filter to keep only the gravity component of each axis.
gX = (acceleration.x * kLowPassFilterFactor) + (gX * (1.0 - kLowPassFilterFactor));
gY = (acceleration.y * kLowPassFilterFactor) + (gY * (1.0 - kLowPassFilterFactor));
gZ = (acceleration.z * kLowPassFilterFactor) + (gZ * (1.0 - kLowPassFilterFactor))
}
void PhysicsApplyForceAndTorque (const NewtonBody* body, dFloat timestep, int threadIndex)
{
dFloat Ixx;
dFloat Iyy;
dFloat Izz;
dFloat mass;
NewtonBodyGetMassMatrix (body, &mass, &Ixx, &Iyy, &Izz);
// I also normalize [gX,...]
dVector force = dVector ( gX*gravity*mass, gY*gravity*mass, gZ*gravity*mass );
NewtonBodySetForce (body, &force.m_x);
}
-
Caleb Cannon
-
- Posts: 3
- Joined: Sat Sep 27, 2008 4:28 pm
by Julio Jerez » Sat Oct 04, 2008 2:54 pm
Caleb Cannon wrote:The moments of inertia are wrong for some objects. I'm using a cube moment for everything and it isn't scaled to the objects mass, e.g., NewtonBodySetMassMatrix(body, 1.0f, 1.0f/6.0f, 1.0f/6.0f, 1.0f/6.0f);
I asume you are using tjhsi to have a quick demo, but maybe you sould use the ulitity funtions that calculate the principal inertial
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by kayanat » Fri Mar 13, 2009 3:45 am
Wow!! it's looks cool on my i phone. I really love it. I hope you guys will come up with new exciting stuffs in future.
-
kayanat
-
- Posts: 1
- Joined: Mon Mar 09, 2009 6:17 am
Return to User Gallery
Who is online
Users browsing this forum: No registered users and 42 guests