Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Simple object collision

Author
Message
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 22nd Mar 2017 11:48
Hello

I want to explain a little bit of the situation before I ask my question:

I am making a MMORPG environment, so object collision is both server side (for important collisions, walls, fences, etc) and client side (client side includes all server side collisions + collisions that don't matter for cheating, tree, table, etc)
I stayed away from physics right now, because I don't need advanced physics in my environment. I'm pretty new to AppGameKit and 3D development, and there are a lot of things I don't understand about physics in the documentation.

I just want to know if an object collides with another object, my tought process is now this:
-Create all my objects that collide as static physics objects
-Set a collisionshape for every object (a collision shape that resembles the real object)
-check collision on client side via contactsreports

Questions:
Is the ScaleFactor of the 3DPhysicsWorld important for static bodies? I use 1 unit = 1 metre everywhere.

What should I do on server side? My server isn't written in AGK. I read that it is possible to export a.bcs file, but I cannot find any information on how to parse this file myself. Is this a AppGameKit file format, is it documented somewhere?

Is it possible to not use physics altogether but use raycasting of some sort? I just need very simple collision, nothing fancy.

Thanks for your insight!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Mar 2017 12:17 Edited at: 22nd Mar 2017 12:19
easy way is Circle-Line Intersection or Circle-Circle Intersection as Function. or distance - radius1 -radius 2 < 0
http://mathworld.wolfram.com/Circle-LineIntersection.html
http://mathworld.wolfram.com/Circle-CircleIntersection.html

i think with 2 static objects you do not get collision information. only if one dynamic move into other.
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 22nd Mar 2017 13:01 Edited at: 22nd Mar 2017 13:07
Hmh

I don't really know what to do with the links you've replied.
So in this example:



There is no way to detect that those boxes collide?

I was hoping for a https://www.appgamekit.com/documentation/Reference/Sprite/GetPhysicsCollision.htm but for 3D :')

I tested 2 static meshes, that doesn't work indeed. That's a pain, because I don't want them to be affected by gravity or other physics things (like weight or so)

Thanks

Edit: I was Googling, 2 things would be very easy:

-Using a raycast from the center of my object, in this case, every object must fit a cylinder.
-Using spheres, collision of spheres is simple.

But ideally, I would also have box collision, but I cannot think of a method to do that if an object is rotated.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 22nd Mar 2017 13:02
You could create a 2 dimension array, world[ X, Z ] and precalculate every collision point in the game. (So start at 1, 1 and store the collision result in the array. then 1, 2 and so on. Then, to get collision later, simply do a lookup on the array. World[ PlayerX, PlayerZ ] If you want full 3d collision, then add the Y Direction to the array. Round the player location to an integer as well.
This will be by far the fastest method in game, but does take a lot of precalculation beforehand.
Signature removed by mod because it's larger than 600x120... please resize and try again.
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 22nd Mar 2017 13:13
Mobiius

Thanks for your answer!

I'm talking 3D here. I understand what you mean. But it's one thing that I don't know how to do with 3D objects (that can be rotated) :

Quote: "precalculate every collision point in the game"


How could I do that?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Mar 2017 14:05
Quote: "But ideally, I would also have box collision, but I cannot think of a method to do that if an object is rotated."

you mean at your non agk server,true?
think also about differentiate it
box-triangle
mesh-box
box-box
box-sphere
box-line
sphere-sphere
line-sphere
line-triangle
...

AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 22nd Mar 2017 14:07
I also mean in AppGameKit, I don't know how to do box collision of 2 static objects.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 22nd Mar 2017 15:57
Quote: "Is the ScaleFactor of the 3DPhysicsWorld important for static bodies? I use 1 unit = 1 metre everywhere."


Yes, the scale factor applies to the entire 3D physics world.

Quote: " I read that it is possible to export a.bcs file, but I cannot find any information on how to parse this file myself. Is this a AppGameKit file format, is it documented somewhere?"


This is a Bullet Physics Engine collision shape file. It stores collision shape data that is only relevant to the Bullet Physics Engine.

Quote: "I tested 2 static meshes, that doesn't work indeed. That's a pain, because I don't want them to be affected by gravity or other physics things (like weight or so)"


Static objects do not move or collide with other static objects. Dynamic objects collide with static and kinematic.

The built in 3d physics is very robust and should work for your purpose.
The coffee is lovely dark and deep,and I have code to write before I sleep.

Login to post a reply

Server time is: 2024-11-24 18:22:15
Your offset time is: 2024-11-24 18:22:15