Hey everyone,
so I found posts about applying gravity to certain objects and I keep getting a Reference Error and am not sure what to do about it.
I loaded up b2Island.as and switched the gravity code to
and when building my body's I do
bodyRef.userdata = new Sprite();
bodyRef.userdata.gravity = true/false;
And everytime I run this I get
ReferenceError: Error #1056: Cannot create property gravity on flash.display.Sprite.
Help!
so I found posts about applying gravity to certain objects and I keep getting a Reference Error and am not sure what to do about it.
I loaded up b2Island.as and switched the gravity code to
Code:
if ( b.m_userData.gravity == false ){
b.m_linearVelocity.x += step.dt * (b.m_invMass * b.m_force.x);
b.m_linearVelocity.y += step.dt * (b.m_invMass * b.m_force.y);
} else {
b.m_linearVelocity.x += step.dt * (gravity.x + b.m_invMass * b.m_force.x);
b.m_linearVelocity.y += step.dt * (gravity.y + b.m_invMass * b.m_force.y);
} //end if else
b.m_linearVelocity.x += step.dt * (b.m_invMass * b.m_force.x);
b.m_linearVelocity.y += step.dt * (b.m_invMass * b.m_force.y);
} else {
b.m_linearVelocity.x += step.dt * (gravity.x + b.m_invMass * b.m_force.x);
b.m_linearVelocity.y += step.dt * (gravity.y + b.m_invMass * b.m_force.y);
} //end if else
and when building my body's I do
bodyRef.userdata = new Sprite();
bodyRef.userdata.gravity = true/false;
And everytime I run this I get
ReferenceError: Error #1056: Cannot create property gravity on flash.display.Sprite.
Help!