Page 1 of 1

directional velocity minus ???

PostPosted: Tue Jul 13, 2010 2:56 pm
by sportmaster
why this code [key down, repeat -> script editor] is working with x velocity and y velocity but with directional velocity it doesn't ?
Code: Select all
...velocity -=1;

Re: directional velocity minus ???

PostPosted: Tue Jul 13, 2010 3:13 pm
by jimmynewguy
Code: Select all
directional_velocity-=1;

that should definately work, if it isnt something has to be wrong. Make sure the repeat is on i guess. Dont know what to tell you really if that doesnt work.

Re: directional velocity minus ???

PostPosted: Tue Jul 13, 2010 3:50 pm
by lcl
Make sure you have some value in angle. Angle and directional_velocity work together. :D

Re: directional velocity minus ???

PostPosted: Tue Jul 13, 2010 11:53 pm
by sportmaster
dont know whats going on :( please take a look at this. Press down button and see the problem. The angle is 90, repeat is enabled and code is : directional_velocity -=1; The movement isnt smooth and its to slow.

Re: directional velocity minus ???

PostPosted: Wed Jul 14, 2010 12:58 am
by DST
Don't use the - sign for the directional_velocity, it's supposed to be positive direction. When you use -1 dv + 90 angle, you're actually moving 270 degrees instead of 90.

Try:

directional_velocity=1;
angle=270;

on the keydown>down.

Directional velocity is a constant, you wouldn't want to add to it, just set it. Never use negative values on it, instead, just change your angle.

Re: directional velocity minus ???

PostPosted: Wed Jul 14, 2010 1:07 am
by Hblade
DST

Heres a whopper for ya...

How would I go about calculating the angle AND velocity speed (Directional_velocity?) of the impact when a collision is made on something with a slanted surface. In other words, I want to say if I collide into something with a 34 degree angle, that it would act as a physical response but I dont want to use physical response, because when it comes to particles or many actors you know that physical response lags xD

Re: directional velocity minus ???

PostPosted: Wed Jul 14, 2010 6:42 am
by DilloDude
You'll need a way of knowing the angle of the surface. See my post here.
Then you'll need to measure the difference between these angles, using getangle.
Then you can find the correct angle to bounce off.

Re: directional velocity minus ???

PostPosted: Wed Jul 14, 2010 8:51 am
by Bee-Ant
Hblade wrote:I want to say if I collide into something with a 34 degree angle, that it would act as a physical response but I dont want to use physical response, because when it comes to particles or many actors you know that physical response lags xD

Hmmm...if you want to make physical response without using Physical Response, try this :

Particle->Collision->Platform :
Code: Select all
angle+=180;
directional_velocity-=directional_velocity;

But I can't guarantee the accuracy. Since it just uses very simple code...

Re: directional velocity minus ???

PostPosted: Wed Jul 14, 2010 9:58 am
by Hblade
Thanks, both of you :D