Characters on the brink of an abyss?

Blitz3D Forums/Blitz3D Programming/Characters on the brink of an abyss?

Yue(Posted 2012) [#1]
I would like to hear any suggestions for the character of my project to be on the verge of a platform can activate an animation as if he would fall, ie meuva arms and if this much time to fall into the void edge.


Yasha(Posted 2012) [#2]
1) Define invisible boxes around the edges of your platforms (in code, not using meshes)

2) Test whether the character's "edge collision radius" overlaps with the edge box (this doesn't have to be their EntityRadius: you should add a separate property for this as the EntityRadius would be too big to be believable)

3) If so, fire an event that engages the "wobbling" state, with the "wobble" event in turn scheduled to fire a "fall" event after the desired time has passed


You can define and test "oriented bounding boxes" using code like this:
http://www.blitzbasic.com/codearcs/codearcs.php?code=414
http://www.blitzbasic.com/codearcs/codearcs.php?code=1920

You can test whether a sphere overlaps an oriented bounding box with a simple extension like this:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1192
(although this particular code isn't very efficient, shouldn't create new entities every time you need to do a math test)

You can fire events with expiry timers like this:
http://www.blitzbasic.com/codearcs/codearcs.php?code=632


(Notice that two of those came from sswift. Take note of the name: sswift is one of the people whose Code Archive submissions you should examine in detail, because they're really good.)

Last edited 2012


RemiD(Posted 2012) [#3]
or
check if there is a ground at front, back, left, right of your character with linepick.

If you keep the number and the complexity of the meshes which can be picked to be low and low tris, this will be fast, and you will not need a manual setup like what Yasha suggested.


Yue(Posted 2012) [#4]
If I have understood correctly, the idea is that the edge of the platform appears to be off balance by the very edge.

Now the question is Swit code is free?


K(Posted 2012) [#5]
If it's in the archives, it's there for people to use, I think.


Yasha(Posted 2012) [#6]
Yep, if it's in the archives it's public domain, and that means you can do whatever you want with it.

There may still be some really old code from around 2000 or so that was before the PD-only policy, but any of that is clearly marked with a big banner at the top saying that it's not PD. And I'm not sure but I think the mods might have gone on a bit of a clearout to remove anything like that anyway.