//----- EDIT -----//
I didn't allow the bounce to occur because the condition was 'if the dot product does not equal zero', which should have been 'if the dot product is greater than zero'. I still have an issue, though - using mouselook from a third person perspective to control the orientation of the character without the mere rotation setting off the bounce function. What would be the condition for that? CollisionNY? If so, what value? Thanks.
//--- END EDIT ----//
Hey all,
I've been working on a prototype of a 3D platformer in which the only form of locomotion is a mouselook/click/drag/release combo. It's sort of a Crash Bandicoot/Spyro meets Pinball with Megaman abilities. In any case, the main character is a little blob who lives in a petri dish. The level design is incredibly organic. My level designer created single-sided walls, all normals face in as they should. One particular obstacle, though, causes my character to get stuck upon colliding with it. This may be due to over-zealous collision detection on my part. (Note: Blitz3D's sliding collisions are out, as the curves of the level cause infinite sliding) Why would this obstacle (a poly model that is part of the same mesh as the entire level) cause sticking? Here is the code for the bounce function:
;---------------------------------------------
Function SZ_bounce.VECTOR(player.VECTOR,Index)
norm\Vx# = CollisionNX(player\root,Index)
norm\Vy# = CollisionNY(player\root,Index)
norm\Vz# = CollisionNZ(player\root,Index)
norm = normalize(norm)
player = normalize(player)
two_ndoti = 2 * (norm\Vx# * player\Vx# + norm\Vy# * player\Vy# +norm\Vz# * player\Vz#)
player\Vx# = two_ndoti * norm\Vx# - player\Vx#;
player\Vy# = two_ndoti * norm\Vy# - player\Vy#;
player\Vz# = two_ndoti * norm\Vz# - player\Vz#;
player\Vx# = (player\Magnitude# - (player\Magnitude# * .1)) * (player\Vx#)
player\Vy# = (player\Magnitude# - (player\Magnitude# * .1)) * (player\Vy#)
player\Vz# = (player\Magnitude# - (player\Magnitude# * .1)) * (player\Vz#)
Return player.VECTOR
End Function
;---------------------------------------------
This is used within a For...Next based on the value of CountCollisions for that frame. Let me know what code would be most helpful in figuring this out. It really ties into a larger issue: diminishing secondary bounces without causing an NaN, giving a realistic effect of landing. I can also make an executable available if you want to get a feel for the mechanics. Thanks in advance, guys.
P.S. - I'd be really honored if sswift made an appearance.
I didn't allow the bounce to occur because the condition was 'if the dot product does not equal zero', which should have been 'if the dot product is greater than zero'. I still have an issue, though - using mouselook from a third person perspective to control the orientation of the character without the mere rotation setting off the bounce function. What would be the condition for that? CollisionNY? If so, what value? Thanks.
//--- END EDIT ----//
Hey all,
I've been working on a prototype of a 3D platformer in which the only form of locomotion is a mouselook/click/drag/release combo. It's sort of a Crash Bandicoot/Spyro meets Pinball with Megaman abilities. In any case, the main character is a little blob who lives in a petri dish. The level design is incredibly organic. My level designer created single-sided walls, all normals face in as they should. One particular obstacle, though, causes my character to get stuck upon colliding with it. This may be due to over-zealous collision detection on my part. (Note: Blitz3D's sliding collisions are out, as the curves of the level cause infinite sliding) Why would this obstacle (a poly model that is part of the same mesh as the entire level) cause sticking? Here is the code for the bounce function:
;---------------------------------------------
Function SZ_bounce.VECTOR(player.VECTOR,Index)
norm\Vx# = CollisionNX(player\root,Index)
norm\Vy# = CollisionNY(player\root,Index)
norm\Vz# = CollisionNZ(player\root,Index)
norm = normalize(norm)
player = normalize(player)
two_ndoti = 2 * (norm\Vx# * player\Vx# + norm\Vy# * player\Vy# +norm\Vz# * player\Vz#)
player\Vx# = two_ndoti * norm\Vx# - player\Vx#;
player\Vy# = two_ndoti * norm\Vy# - player\Vy#;
player\Vz# = two_ndoti * norm\Vz# - player\Vz#;
player\Vx# = (player\Magnitude# - (player\Magnitude# * .1)) * (player\Vx#)
player\Vy# = (player\Magnitude# - (player\Magnitude# * .1)) * (player\Vy#)
player\Vz# = (player\Magnitude# - (player\Magnitude# * .1)) * (player\Vz#)
Return player.VECTOR
End Function
;---------------------------------------------
This is used within a For...Next based on the value of CountCollisions for that frame. Let me know what code would be most helpful in figuring this out. It really ties into a larger issue: diminishing secondary bounces without causing an NaN, giving a realistic effect of landing. I can also make an executable available if you want to get a feel for the mechanics. Thanks in advance, guys.
P.S. - I'd be really honored if sswift made an appearance.