Yep, its pool.
But the thing is, I'm hoping to implement some sort of 3D physics as
well, such as making the ball jump due to striking it at different
angles, so I don't want to get too reliant on the 2D physics-ness. You
could call it preparation.
And well... Updates on what I found would be that:
a) The perfect angle would be the unit vector angle,
Math.sin((stick.rotationY) * Math.PI /180.0 and
Math.cos((stick.rotationY) * Math.PI /180.0, the more i increase it,
the further the angle tilts.
b) The delta seems to have no effect on the resulting velocity
c) At maximum tilt, the angle will be according to where its facing,
using the 45 degree angle of that side (45, 135, 225, 315)
... Yeah.
public function applyBodyWorldImpulse(impulse:Vector3D,
delta:Vector3D):void
{
if (!_movable)
{
return;
}
_currState.linVelocity =
_currState.linVelocity.add(JNumber3D.getScaleVector(impulse,
_invMass));
var rotImpulse:Vector3D = delta.crossProduct(impulse);
JMatrix3D.multiplyVector(_worldInvInertia, rotImpulse);
_currState.rotVelocity =
_currState.rotVelocity.add(rotImpulse);
_velChanged = true;
}
That would be the code in the main file, if that helps...
Really hope someone can give me a hand!
On Mar 15, 10:40 pm, "Joshua Granick" <[email protected]>
wrote:
> Is this for something like pool?
>
> You might be able to use a 2D physics engine to get this working. APE is
> really easy to pick up and run with, and Box2D has a pretty good feature set,
> though the API could certainly be improved.
>
>
>
> On Sun, 14 Mar 2010 21:10:45 -0600, Novora <[email protected]>
> wrote:
> > ... Eh?
>
> > But from what I tried, the impulse seems to have the hugest problem
> > with the direction of where the object travels after, 'cuz whenever I
> > modify it even a bit, the entire direction will screw up in ways that
> > I dislike strongly... According to what I read, they said that delta
> > refers to the "offset vector" or something? Couldn't understand that
> > bit that well either...
>
> > .applyBodyWorldImpulse(impulse:JNumber3D, delta:JNumber3D):void
>
> > My code looks like this now by the way
>
> > var shotPower = shotChargeNum * 5000 * stick.mass
> > var minShot = 5000 * stick.mass
> > var xShoot = (shotPower) * Math.sin((stick.rotationY) * Math.PI /
> > 180.0)
> > var zShoot = (shotPower) * Math.cos((stick.rotationY) * Math.PI /
> > 180.0)
>
> > trace(xShoot)
> > trace(zShoot)
> > var shootVector;
> > shootVector = new Vector3D(xShoot / shotPower, 0, zShoot / shotPower)
> > trace(shootVector)
>
> > myCueBall.applyBodyWorldImpulse(shootVector, delta);
>
> > P.S By the way, the numbers that I get from this is ENORMOUS. as in,
> > 5-6 digits huge, 'cuz I set the mass of the stick ot a huge number
> > because smaller masses seem to make it get pushed partially by the
> > stick, causing the direction to deviate...
>
> > On Mar 15, 11:00 am, katopz <[email protected]> wrote:
> >> > It also appears that delta refers to the distance between the source
> >> > of the force, and the object to be moved.
>
> >> as i remember "delta" is force direction, and you can use applyWorldImpulse
> >> or applyBodyWorldImpulse for this
>
> >> hth
>
> >> On 15 March 2010 09:28, Novora <[email protected]> wrote:
>
> >> > I'm sorry for posting it over here, but the jiglibflash forums are
> >> > pretty dead, and they haven't answered my question for the past week
> >> > or so, and I REALLY need to find an answer to this...
>
> >> > Does anyone know how the .applyBodyWorldImpulse thing work?
>
> >> > I know there are two parameters needed, and they are labelled impulse,
> >> > and delta.
>
> >> > Due to the immense lack of documentation, and the somewhat dead
> >> > forums, I had to experiment to find out exactly what they refer to,
> >> > and I've only got myself more confused.
>
> >> > It appears as though impulse refers to the direction vector of the
> >> > impulse, as when I used the cosine sin method to find the x and y
> >> > values to move, it moved in that direction.
>
> >> > It also appears that delta refers to the distance between the source
> >> > of the force, and the object to be moved.
>
> >> > However, I can't find out exactly how to make it move faster, a.k.a
> >> > increase the force applied to the object... The only clue I got was
> >> > that the impulse appears to cause a difference, although when I tried
> >> > multiplying it, the angles went haywire...
>
> >> > Can someone give me a hand, or at least direct me? I'm quite desperate
> >> > for help. The main thing I need to know is exactly how this thing
> >> > works, and perhaps examples if you know any.
>
> >> --
> >> katopzhttp://www.sleepydesign.com
>
> --
> Using Opera's revolutionary e-mail client:http://www.opera.com/mail/