Ooops
March 05, 2021, 07:22:49 PM

Author Topic: PhysLite Issues  (Read 419 times)

Offline Hardcoal

PhysLite Issues
« on: January 25, 2021, 08:49:57 PM »
Im learning this PhysLite 2D engine now.
and something really strange which I cant understand..

when I run my simulation of lets say a bridge of attached masses.. they suddenly stop being simulated..
as if they went into sleep mode..

when i produce another bridge.. it works.. without entering sleep mode.. and than again another one does enter sleep mode..

anyone one has any Idea?

Ive already compared it to many code examples.. and I cant figure it out..
so weird..

anyway ive attached what I did..
Press mouse to produce a new bridge..

Code: [Select]
Method CreateBridge:Tmass[] (X:Float = 10, Y:Float = 10, Size:Float = 300, Sections = 5)
Local BridgePart:TMass[], bridge:TBody, TempM:TMass, I, Radius:Float, XC:Float, Friction:Float = 1
Local Mass:Float = 10

If Sections < 3 Then Return
If Sections > 100 Then Return

Radius = size / (Sections * 2)

bridge = New TBody

BridgePart = BridgePart +[MassCreate(X, Y, Mass, Radius, Friction, 99)]
TempM = BridgePart[0]

Local c:TConstraint
For I = 1 To Sections
BridgePart = BridgePart +[MassCreate(X + XC, Y, Mass, Radius, Friction, 99)]
c = ConCreate(TempM, BridgePart[I])
c.Assign (bridge)
TempM = BridgePart[I]
XC = XC + Radius * 2
Next

BridgePart = BridgePart +[MassCreate(X + Size, Y, Mass, Radius, Friction, 99)]
c = ConCreate(BridgePart[I - 1], BridgePart[I])
c.Assign (bridge)

BridgePart[0].Freeze()
BridgePart[I].Freeze()

ListAddLast(PhyObjList, BridgePart)

Return BridgePart
End Method

hmmmm

Offline blinkok

Re: PhysLite Issues
« Reply #1 on: January 25, 2021, 09:35:58 PM »
This happens with all physics systems based on box2D. You need to turn off the objects ability to sleep

Offline Hardcoal

Re: PhysLite Issues
« Reply #2 on: January 25, 2021, 09:53:25 PM »
How? what is the command for this?
And how come it doest happen on the demos Ive checked..


ive found a command called TBody.SetAutoSleep(False)

but it wont let it work.. its unrecognized for some reason..
hmmmm

Offline blinkok

Re: PhysLite Issues
« Reply #3 on: January 25, 2021, 10:37:02 PM »
I am not familiar with this physics system. Your issue seemed strikingly similar to the Box2D one i described


Offline Hardcoal

Re: PhysLite Issues
« Reply #4 on: January 26, 2021, 06:29:36 PM »
Im fed up with this stupid  error.. I cant understand this..
So I guess ill give up on this too..

Ive never seen such an annoying error. cant figure it after many experiments..

Ill move on
hmmmm

Offline Hardcoal

Re: PhysLite Issues
« Reply #5 on: January 27, 2021, 07:39:01 PM »
Ok. I realized what was my silly Issue/Error..
Sorry PhysLite..

I used Local TBody, Instead of Global..
Hurray.. I can continue now..


hmmmm

Offline _PJ_

Re: PhysLite Issues
« Reply #6 on: January 30, 2021, 07:34:20 PM »
Ok. I realized what was my silly Issue/Error..
Sorry PhysLite..

I used Local TBody, Instead of Global..
Hurray.. I can continue now..

I think all the most challenging issues follow this same pattern!!!

1) Code the next feature
2) Identify some bugs
3) Scour code and maybe add in some feedback / breakpoints to isolate bugs
4) Bash head against desk repeatedly as no clues appear other than "it's just not working"
5) Suddenly notice it was a silly mistake

Psychologically, I believe this is very common due to the fact that we expect that the problem is with the logic and commands we have been adding.
Typically, Local / Global scope definition would be a very trivial thing, so we gloss over checking that as it would not be expected to have been such a mistake. Instead we focus on minutae of functional and computational aspects and get ever more puzzled since they are of course, perfectly correct!

So glad to hear you solved it.

Offline Hardcoal

Re: PhysLite Issues
« Reply #7 on: January 30, 2021, 08:46:02 PM »
In this case. it was more of general lack of understanding how the garbage collector works..
so what happened is that the garbage collector collected my TBODY while it was running..
hence the sudden physical simulation stop.
once i realized it.. i took the TBODY out of the  Function.

I simply didnt realize.. something that works can be suddenly collected..
hmmmm

Offline Hardcoal

Re: PhysLite Issues
« Reply #8 on: February 01, 2021, 09:48:49 PM »
after spending like a week with physlite.. I realized there is no way to make collisions with say. Rect to Rect..
it all works on mases..

can anyone really tell me which 2d engine is best to invest in?
I Dont feel like wasting so much time for than realizing such a basic thing does not exist in a 2D physics  engine..

It seems like Box2D is the best around.. but there is also this Chipmunk Engine..

why do people recommand on Physlite when it seems like box2d gives much more..
If Im wrong. please correct me, so I can concentrate on the right Engine and develop my own commands.



hmmmm

Offline Hardcoal

Re: PhysLite Issues
« Reply #9 on: February 02, 2021, 06:51:01 PM »
Ive never seen a more annoying and unclear inconvenient to understand 2D physics Framework or any other frameworks that Ive tried, than Box2D,
Yet, ill keep trying to learn/understand it. since it seems worthy the effort.

How can a 2D physics engine be more complex than Strings theory.

hmmmm

Offline GW

Re: PhysLite Issues
« Reply #10 on: February 03, 2021, 12:37:58 AM »
I investigated Physlite when I made MazeEscape http://www.kerneltrick.com/?p=36 .  I ended up writing my own physics instead. Do you need a full physics engine?
If you just just need basic collision detection and response, It might be easier to code it up yourself.  Both chipmunk and box2d are dead for BMax I think. There are a few physics engines that were written in pure Monkey long ago, you could try porting one of those over.
 

Offline Hardcoal

Re: PhysLite Issues
« Reply #11 on: February 03, 2021, 03:15:05 AM »
why do you say box2d is dead? :) its working..
Its just made horribly complicated. and im trying to simplify it.. to the point its usable by mortals..

Thanks for your offer GW . well i need more than just collision detection.. but ill download what you did and test it as well.

physlite is a walk in the part compared to box2d!

Im gonna make box2d great again I promise :)

well hopefully at least,

than ill post my code here..

i also tried newton physics which is a 3D physics. but i didnt manage to make it work.
i tried to use hitoro mod.. under blizmax 1.50

what i do is I take an engine and make my own library to simply things..
and thats what im gonna do with box2d



hmmmm

Offline Hardcoal

Re: PhysLite Issues
« Reply #12 on: February 03, 2021, 04:25:21 AM »
Im proud to say that I cracked the complexity of the Box2D and Im simplifying it to a point that it will be ultra easy to use.

theres nothing in box2d that was made simple..
Even the Y position coords of objects goes Up like in a 3D environment, instead of down as a normal 2D environment usually use.

I simplified it to a

Create2DWorld()
CreateBox()

and so on..

lets hope it will be worth the effort
hmmmm

Offline Hardcoal

Re: PhysLite Issues
« Reply #13 on: February 06, 2021, 07:01:33 PM »
hi, If anyone have some box2d code examples besides the basic ones.. ill be happy to see it here..
there is the collision issue which i still dont understand

collision detection and many more..

cheers


Thanks PJ
hmmmm

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal