Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 9 Vote(s) - 4.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Work in progress Katamari: The dark descent (Update 16/11)
darkadders Offline
Junior Member

Posts: 44
Threads: 1
Joined: Mar 2012
Reputation: 3
#32
RE: Katamari: The dark descent

(08-02-2011, 05:05 PM)Apjjm Wrote:
Contact point discovery
Spoiler below!

Given a spherical object A is colliding with object B, how do i find the contact point on object A?
[Image: 9QF9C.png]
Amnesia has no way, sadly, to determine the position of entities or contact points using available functions. Filling the entire map with script areas would solve the problem, but for just a 5x5x5 room, with enough script areas to accurately determine a box and a ball colliding, you'd be looking at 8,000 entities - then for each of these areas you would have to check for collisions between the two objects to determine a set of points, This is far too much work to do without lag, let alone in a 200x200x20 map!

However, given that we know the two objects must be close to each-other, we can reduce that obscene amount of areas to ~100 static entities, which exist for under a frame, and only a few of which are ever even in the game at the same time!

The solution: As soon as a collision occurs, create a large box around one of the colliding objects (in this mod it is the katamari, and is done using the AddAttachedPropToProp function). If there is a collision with the big box and both entities, we split the big box into 8 smaller boxes. We then do that same process for all 8 smaller boxes, and keep going until the boxes are really small. As soon as we have determined a collision for a box, we can destroy that box (RemoveAttachedPropFromProp).
[Image: x68UO.png]
This is like an octree spatial partitioning technique, except we don't bother saving the tree, as it will be useless after we get the contact points. We keep dividing down and hone in on all the boxes that collide with both objects. We get a head-start, too, as we actually start at the centre of our spherical object.
[Image: verED.png]

At the smallest box size, we may have multiple boxes that collide with both entities! We want one contact point, not a set! Thankfully, because we created each box this frame, we know the position of each one relative to our first entity (the katamari). All we do is calculate the (square) distance from the katamari for each small box - we then only keep the position that was furthest away - as this will be the point at which the main object (katamari) first touched the other object. This is all the information we need to get where to attach the object to on the katamari.

This is just a quick overview, the code this time around is much better organised and commented than with tetris, so when the mod is released and you want to see exactly how it was done, then it shouldn't be too hard to follow Wink.

mind = f***ed


props to you guys for figuring out how to make these things; its harder than it looks Q_Q

04-10-2012, 02:26 PM
Find


Messages In This Thread
RE: [WIP] Katamari: The dark descent - by Mosnye - 07-31-2011, 01:04 AM
RE: [WIP] Katamari: The dark descent - by Kyle - 07-31-2011, 01:32 AM
RE: [WIP] Katamari: The dark descent - by Apjjm - 07-31-2011, 01:35 AM
RE: Katamari: The dark descent - by skypeskype - 07-31-2011, 05:56 PM
RE: Katamari: The dark descent - by MrCookieh - 07-31-2011, 06:17 PM
RE: Katamari: The dark descent - by Kyle - 07-31-2011, 07:18 PM
RE: Katamari: The dark descent - by DamnNoHtml - 07-31-2011, 08:35 PM
RE: Katamari: The dark descent - by Cryaotic - 07-31-2011, 08:38 PM
RE: Katamari: The dark descent - by skypeskype - 08-01-2011, 10:27 AM
RE: Katamari: The dark descent - by Your Computer - 07-31-2011, 10:33 PM
RE: Katamari: The dark descent - by Apjjm - 08-01-2011, 01:12 AM
RE: Katamari: The dark descent - by bobbo - 08-01-2011, 01:35 PM
RE: Katamari: The dark descent - by Your Computer - 08-02-2011, 12:58 PM
RE: Katamari: The dark descent - by DamnNoHtml - 08-01-2011, 01:31 AM
RE: Katamari: The dark descent - by Tanshaydar - 08-01-2011, 02:20 AM
RE: Katamari: The dark descent - by Frost - 08-01-2011, 12:59 PM
RE: Katamari: The dark descent - by Mosnye - 08-02-2011, 08:09 AM
RE: Katamari: The dark descent - by Tenno - 08-02-2011, 08:11 AM
RE: Katamari: The dark descent - by Apjjm - 08-02-2011, 05:05 PM
RE: Katamari: The dark descent - by Your Computer - 08-02-2011, 06:24 PM
RE: Katamari: The dark descent - by darkadders - 04-10-2012, 02:26 PM
RE: Katamari: The dark descent - by Furix - 08-22-2011, 08:58 AM
RE: Katamari: The dark descent - by skypeskype - 08-23-2011, 03:39 PM
RE: Katamari: The dark descent - by Mosnye - 08-24-2011, 12:50 AM
RE: Katamari: The dark descent - by Henriksen - 08-30-2011, 05:09 PM
RE: Katamari: The dark descent - by Jinxi - 11-25-2011, 11:48 PM
RE: Katamari: The dark descent - by Homicide13 - 04-09-2012, 05:47 AM
RE: Katamari: The dark descent - by Apjjm - 04-09-2012, 01:06 PM
RE: Katamari: The dark descent - by Homicide13 - 04-09-2012, 11:12 PM
RE: Katamari: The dark descent - by Adrianis - 04-09-2012, 11:12 PM
RE: Katamari: The dark descent - by Apjjm - 06-09-2012, 06:01 PM
RE: Katamari: The dark descent - by Statyk - 06-10-2012, 12:07 AM
RE: Katamari: The dark descent - by Apjjm - 06-10-2012, 02:26 AM
RE: Katamari: The dark descent - by Statyk - 06-10-2012, 03:03 AM
RE: Katamari: The dark descent - by Apjjm - 06-10-2012, 03:40 AM
RE: Katamari: The dark descent - by Science - 06-10-2012, 06:04 AM
RE: Katamari: The dark descent - by Statyk - 06-10-2012, 07:02 AM
RE: Katamari: The dark descent - by Adny - 06-10-2012, 11:48 AM



Users browsing this thread: 1 Guest(s)