Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, BrainSailor, 1 invisible), 1,234 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Making the window "wrap" (w/ Physics entities) #204297
04/28/08 15:14
04/28/08 15:14
Joined: Feb 2002
Posts: 357
Florida
Zelek Offline OP
Senior Member
Zelek  Offline OP
Senior Member

Joined: Feb 2002
Posts: 357
Florida
I have a static (non-moving) camera view and a bunch of physics enabled spheres that bounce around inside the view. What I would like to have happen, is for the spheres that pass the left boundary of the screen to "wrap" around to the right boundary of the screen, and vice-versa.

Now I'm fairly confident I could do this with non-physics objects, but not sure if it's possible to do it seamlessly with physics objects. Do I need to get their velocity & direction when they pass the boundary, remove them, and create a new physics entity on the other side of the screen? Is there another more reasonable way?

Re: Making the window "wrap" (w/ Physics entities) [Re: Zelek] #204436
04/29/08 09:37
04/29/08 09:37

M
mercuryus
Unregistered
mercuryus
Unregistered
M



Set off the objects physical behavior (phent_enable ( entity, var enableEntity );) if it reaches the border.
Then replace it (e.g. obj.x-=1000 or obj.x=[new value]).
At least switch on the objects physical behavior again.

mercuryus

Re: Making the window "wrap" (w/ Physics entities) [Re: ] #204575
04/30/08 01:23
04/30/08 01:23
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline
User
Trooper119  Offline
User

Joined: Apr 2004
Posts: 516
USA
I believe what mercuryus is trying to say is make the walls passable, and after the ball first enters the (now passable) boundary, make a ball spawn at the other side with the same offset as the ball entering the other side (something like newball.x = rightBound.x + (ball.x-leftBound.x) vise versa with the opposite side)

Now transfer all settings of the first ball to the other (speed, trajectory, ect.)
Once the first ball is outside of sight, delete it from the level (you could just say any ball outside a certain area beyond the boundary is to be deleted). Hope this helps


A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: Making the window "wrap" (w/ Physics entities) [Re: Trooper119] #204585
04/30/08 04:00
04/30/08 04:00
Joined: Feb 2002
Posts: 357
Florida
Zelek Offline OP
Senior Member
Zelek  Offline OP
Senior Member

Joined: Feb 2002
Posts: 357
Florida
Hey, thanks to both of you for your help. Mercuryus' solution worked perfectly and kept me from having to remove and recreate the physics object. So simple, I'm a little embarrassed I didn't think of it myself :).


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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