[ODE] dBodyAddForce problem

jnilson_99@yahoo.com jnilson_99 at yahoo.com
Thu Dec 5 04:16:02 2002


Thanks Chris,  yep I was using a 3 and not a 2. I
think I'll make that eye doctor appointment after all
:D.

john



--- Chris Campbell <chris.campbell@l8tech.com> wrote:
> 
> just at a glance i think maybe the '3' in this line
> should be a '2' ....?
> maybe
> 
>
{AppCamera::instance().m_vView[0],AppCamera::instance().m_vView[1],AppCamera
> ::instance().m_vView[3],0};
> 
> > -----Original Message-----
> > From: jnilson_99@yahoo.com
> [mailto:jnilson_99@yahoo.com]
> > Sent: Thursday, December 05, 2002 7:32 PM
> > To: ode@q12.org
> > Subject: [ODE] dBodyAddForce problem
> > 
> > 
> > 
> > I'm having a problem setting the force on a body
> > using:
> > 
> > dBodyAddForce (body[0],fx,fy,fx);//see more code
> below
> > 
> > BACKGROUND:
> > At a high level I'm trying to 
> > - place a body at the origin
> > - then typing the 'f' key to increase the force
> scalar
> > - move around the origin with the 'a','s','d','w'
> keys
> > and look left,right,up,down using the mouse
> > (this is just like in any First Person Shooter)
> > - when I click the Left Mouse button, I grab the
> > camera/view vectors and use them to detirmine the
> > force vector(ie the direction to apply force in, I
> > scale the vector by the force scalar incremented
> with
> > the 'f' key.
> > 
> > PROBLEM:
> > When I hit the Left Mouse button, the object ONLY
> > travels down the Z axis. No matter where I
> position
> > the camera, thus generating a different force
> vector,
> > no joy. The body always move only down the Z axis.
> I'm
> > now stuck....
> > 
> > 
> > 
> > if(button == 0 && state == 1)
> > {
> >     dVector3 view =
> >
>
{AppCamera::instance().m_vView[0],AppCamera::instance().m_vVie
> > w[1],AppCamera::instance().m_vView[3],0};
> >     dNormalize3 (view);
> > 
> >     double fx = force*view[0];
> >     double fy = force*view[1];
> >     double fz = force*view[2];
> >     dBodyAddForce (body[0],fx,fy,fz);
> >     dBodyAddForce (body[0],0,-GRAVITY,0);
> > }
> > 
> > if(button == 2)
> > {
> >     dBodyDestroy(body[0]);
> >     dMass m;
> >     dMassSetBox (&m,1,SIDE,SIDE,SIDE);
> >     dMassAdjust (&m,MASS);
> >     body[0] = dBodyCreate (mworld);
> >     dBodySetMass (body[0],&m);
> >     dBodySetPosition
> (body[0],0.5*SIDE,0.5*SIDE,1);
> > }
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> > http://mailplus.yahoo.com
> > _______________________________________________
> > ODE mailing list
> > ODE@q12.org
> > http://q12.org/mailman/listinfo/ode
> > 
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com