How to calculate the velocity of an actor?
Andrea_Comisi
ItalyMember Posts: 328
So i got an actor that collide diagonally with another actor so actor n2 have to change the velocity to the actor n1 velocity but in another direction.
How i can calculate the velocity of an actor? @armelline @the_gamesalad_guru @tatiang @socks
Comments
Vector to angle( actor 1 x - actor 2 x, actor 1 y - actor 2 y)
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@the_gamesalad_guru that is to calculate the angle but for the velocity?
I would know what is the function to calculate the velocity of an actor ( it's for the air hockey style game with you helped me)
I want to calculate the paddle velocity so i can constrain the puck velocity to it
@Andrea_Comisi, you can use
magnitude(self.motion.velocity.X,self.motion.velocity.Y)
to get the velocity.
It does the same as the classical sqrt((velocity.X * velocity.X)+(velocity.Y * velocity.Y))
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Thank you @hopscotch i will test it as soon as possible
@hopscotch i can't constrain any attribute to the linear velocity because even if i constrain it to an attribute still be 0( i tried with integer real and undex)! Any solution? It wirk only if i unlock the prototype
And directly use te linear velocity of the actor trough current scene-layers....
@Andrea_Comisi, upon collision calculate the velocity of the first actor, pass the value to a game attribute and read it out in the second actor. Make sure your actors are either ordered correctly in the layers so that actor 1 gets processed first, or even better, wait one draw call before testing the game attribute.
It is not quite clear what you are going for, maybe a screenshot or sketch will help.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
I will use the unocked prototype is more simple
@hopscotch i can't upload anythink because now im using the my phone internet because i don't have wifi there's a black out
Problem solved
That's how I did my game.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@the_gamesalad_guru if i'm not wrong you used a change velocity bhavior but i wanted a ball that increase its speed if the paddle collide with it fast and decrease its speed if the paddle collide with it slowly and finally i got it, withh your method the ball collide with the paddle but the velocity is ever 1500.
MANY THANKS FOR THE YOUR HELP AND FOR THE YOUR AVAILABILITY @The_Gamesalad_Guru and @Hopscotch
Just set a max speed value in the puck actor if you don't want it to go above a speed. Max speed value is in the list on the left window of the actor. Just check the box and enter a value.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
This can only limit the velocity. With the @hopscotch method i create a more realistic bouncing of the puck in the paddle. Now the problem is solved so this discussion can be closed
@BlackCloackGS can you close this thread and why the my last post is yellow?