Author Topic: Make a bot bounce  (Read 3532 times)

http://paulbourke.net/geometry/reflected/
In:
Code: [Select]
PuckArmor::onCollision(%this,%obj,%col,%thing,%other)would %thing be the normal?

and how do you multiply vectors

« Last Edit: June 17, 2013, 03:47:13 PM by Aide33 »

In:
Code: [Select]
PuckArmor::onCollision(%this,%obj,%col,%thing,%other)would %thing be the normal?

and how do you multiply vectors


vectorscale

vectorscale
nah I made my own function to multiply two vectors together

So assuming %thing is the normal would this be right?

   
Code: [Select]
        %fvec = vectorNormalize(%this.getFowardVector());
%normal = vectorNormalize(%thing);
%vec1 = vectorMultiply(%fvec,%normal;
%vec2 = vectorMultiply(%normal,%vec1);
%vel = vectorAdd(vectorDist(%normal,%fvec),%vec2);
%this.setVelocity(%vel);

That's the collision location.
%other is the velocity.
there is also no vector Multiply function.
« Last Edit: June 17, 2013, 08:59:31 PM by Alphadin »

there is also no vector Multiply function.

nah I made my own function to multiply two vectors together

god damnit how did i overlook that part there twice.

That's the collision location.
%other is the velocity.
there is also no vector Multiply function.
so wheres the normal?

vectorNormalize(%other);
i realized that %other is a single number
you were probably right on using %thing.
which is strange because on my own code using %other works fine.
and when doing this there seems no pre-defined collision point.
i really don't get this anymore

Aide you are going to need so much more than just getFowardVector();
Why?
what if we hit the side?
We didn't hit the forward location.
We hit the side.
Considering I've been brain washed with world boxes, you could probably utilize getWorldboxCenter here.
« Last Edit: June 19, 2013, 02:09:06 AM by Alphadin »

vectorNormalize(%other);
i realized that %other is a single number
you were probably right on using %thing.
which is strange because on my own code using %other works fine.
and when doing this there seems no pre-defined collision point.
i really don't get this anymore

Aide you are going to need so much more than just getFowardVector();
Why?
what if we hit the side?
We didn't hit the forward location.
We hit the side.
Considering I've been brain washed with world boxes, you could probably utilize getWorldboxCenter here.
I have no idea about the arguments anymore, it always tells me that %obj is a brick datablock idk why

and what does getWorldboxCenter do
Maybe instead of getting the forward vector I could get the velocity? would that make it work since velocity is a direction right?

EDIT: I think I found my problem, why doesn't onCollision call when it hits a brick
« Last Edit: June 19, 2013, 09:03:01 AM by Aide33 »

Considering I've been brain washed with world boxes, you could probably utilize getWorldboxCenter here.

getWorldBoxCenter is inaccurate on the default player model, use getHackPosition instead.



getWorldBoxCenter is inaccurate on the default player model, use getHackPosition instead.
Port you also have to factor in bricks. Unless he only wants bouncing on players.
He'd need worldboxcenter for bricks, hack position for players

EDIT: I think I found my problem, why doesn't onCollision call when it hits a brick
because that's just how blockland rolls. oncollision with bricks exists on projectiles, but not playetypes.

because that's just how blockland rolls. oncollision with bricks exists on projectiles, but not playetypes.

Well then screw bots, I'm going back to projectiles

I don't need anything in this thread so I'm gonna lock it