Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Petra, AndrewAMD, Quad, VoroneTZ, 1 invisible), 488 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
2 Questions about pinball like stuff. #174653
12/24/07 21:45
12/24/07 21:45
Joined: Dec 2003
Posts: 129
Osnabrück, Germany
Ready Offline OP
Member
Ready  Offline OP
Member

Joined: Dec 2003
Posts: 129
Osnabrück, Germany
Ok, I'm currently working on some things frequently seen in pinball games
First, a bouncer (like, on touch it bounces you(phent ball) away.
Right now, the bouncer entity (a sphere, placeholder) rotates so that its facing the player on impact but I just cant get the actual push to work correctly >_<
Code:
 function event_bounce() 
{
if (event_type == EVENT_IMPACT )
{
vec_set(temp,player.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);

phent_clearvelocity(player);
// this part isnt working right :((
//phent_addvelcentral (player,my.pan ); //schieben
phent_addvelcentral (player, vector(my.pan, 0, 0)); //schieben

return;
}
}


I messed with that for quite some time and I can somehow get it to bounce the player away but the direction it pushes the player to is always [censored] up and never quite right


So now for my second problem
I want to make a function/event that, when the player collides with another phent (another ball in this case) creates a force at the exact impact location so it pushes both balls away. I was thinking about scanning for the nearest vertex where the impact happened but I have no real idea how exactly I should do this :s

Any kind of help or hint would be appreciated

Merry Xmas
- Ready


Do not underestimate people because they have a low post count... :0
Re: 2 Questions about pinball like stuff. [Re: Ready] #174654
12/24/07 22:42
12/24/07 22:42
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
y don't u just attach a constraint to the bumper and use the physics functions for adding torque.


xXxGuitar511
- Programmer
Re: 2 Questions about pinball like stuff. [Re: xXxGuitar511] #174655
12/24/07 23:16
12/24/07 23:16
Joined: Dec 2003
Posts: 129
Osnabrück, Germany
Ready Offline OP
Member
Ready  Offline OP
Member

Joined: Dec 2003
Posts: 129
Osnabrück, Germany
aren't constraints only used to limit the degree of freedom for an object (like, an arm cannot rotate 360° in all directions)
Sorry I'm a poor artist who's new to programming ^^


Do not underestimate people because they have a low post count... :0
Re: 2 Questions about pinball like stuff. [Re: Ready] #174656
12/24/07 23:26
12/24/07 23:26
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
..Sorta, yeah. If you added a hinge constraint to the bumper, then it could only rotate along the z axis.


xXxGuitar511
- Programmer
Re: 2 Questions about pinball like stuff. [Re: xXxGuitar511] #174657
12/24/07 23:36
12/24/07 23:36
Joined: Dec 2003
Posts: 129
Osnabrück, Germany
Ready Offline OP
Member
Ready  Offline OP
Member

Joined: Dec 2003
Posts: 129
Osnabrück, Germany
Hmm, that wouldn't solve my problem I think.

Rotating the bumper to face the player isn't the problem, but to add a force to the player along the bumpers pan axis

..so .. confusing...


Do not underestimate people because they have a low post count... :0
Re: 2 Questions about pinball like stuff. [Re: Ready] #174658
12/25/07 02:45
12/25/07 02:45
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
...Thats what using physics does. The force unto the player is done by the physics engine


xXxGuitar511
- Programmer
Re: 2 Questions about pinball like stuff. [Re: xXxGuitar511] #174659
12/25/07 03:41
12/25/07 03:41
Joined: Dec 2003
Posts: 129
Osnabrück, Germany
Ready Offline OP
Member
Ready  Offline OP
Member

Joined: Dec 2003
Posts: 129
Osnabrück, Germany
duh.. off course
My problem with the bumper is "just" applying either velocity or torque (or both) to the player into the direction of the bumpers pan

While writing this, I had another idea and quickly tested it out
if I use

phent_addvelcentral (player, vec_scale(my.pan, 50));

it seems to work more or less. for some reason it only bounces the player away in 3 of 4 impacts

Got no real ideas yet about the two colliding balls problem though.


Do not underestimate people because they have a low post count... :0

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1