Change Collision Status?

Blitz3D Forums/Blitz3D Beginners Area/Change Collision Status?

CodeOrc(Posted 2008) [#1]
Hi Everybody,

I was wondering if there is a way to change Collision Status on the fly.

example, I have a outside terrain and I want to be able to slide down steep slopes only, but not have slide functioning while on a slight angle because that would make my entire map feel like Ice.

Is there a way to change collision...(collision 1,2,2,2) to (collision 1,2,2,3) on the fly?

I have this so far and it does not work;
;If my_angle < .8900
; Collisions 1,2,2,2
;EndIf
;If my_angle > .8900
; Collisions 1,2,2,3
;EndIf

I do not slide like I was hoping for :(

Thank for looking gang, anyone have a solution ?

thnx :)


D4NM4N(Posted 2008) [#2]
You could:
Use sliding collisions as you are doing
When in contact with terrain "entitycollided" do a downwards pick with "linepick" check the number returned by "pickedNY" the larger the number the steeper it is.
You could then add a controlled number (multiplied by the number returned) to your gravity constant when in this state to force a faster/lesser/none existant slide.

Not very "physics" but it works.


Ross C(Posted 2008) [#3]
Yeah, i'd agree with D4NM4N. What i do is, if the slope is steep enough, i use align to vector and move the character *forwards*. Since he's aligned to the slope, he will move in the direction of the slope, sliding down it.

I align to the Y axis btw. It looks great if you have a sliding animation you can play whilst the character is sliding.


CodeOrc(Posted 2008) [#4]
@ D4NM4N- cool, thx, that is actually working out pretty good.

Um, how can I know if I am walking "up" a vert or walking "down" a vert?


Ross C(Posted 2008) [#5]
I take it you mean slope?

Firstly, find the NX normal. Then compare it to the rotation of the player. I can't off the top of my head remember what you do with the rotation values of the player to get the way the player is pointing though, sorry...

Another thing to do, is, have a pivot attached to the player, sitting just A LITTLE bit in front of him. Make sure it is set to collide with the scenery, sliding collision i think. Now, if the player is walking up a slope, a collision should be registered. If he is walking down a slope, there should be none.

Only problem you run into is if the player hits a vertical obstacile.

ANOTHER way, is another linepick. Do on from the player location, and one slightly either, ahead, or behind. Make sure the linepick is straight down. Then compare the distance of the picks. That will tell you if he is walking up or down a slope.


CodeOrc(Posted 2008) [#6]
Ok, I have it working based on the ideas mentioned here.

All I have left is making it know when I am walking down a slope rather then walking up it.

I appreciate the B3D communities help, u guys are great.


Stevie G(Posted 2008) [#7]
Similar to Ross's suggested approach ..

;check ground height directly below player
Pick1 = LinePick( EntityX( PLAYERmesh ) , EntityY( PLAYERmesh )+50, EntityZ( PLAYERmesh ) , 0 , -100 , 0  )
Height1# = PickedY()

;check ground height 10 units in front of player
TFormPoint 0,0,10,PLAYERmesh, 0
Pick2 = LinePick( TFormedX(), TFormedY()+50, TFormedZ() , 0 , -100 , 0  )
Height2# = PickedY()

If Height1 < Height2 
	;going uphill
EndIf



Ross C(Posted 2008) [#8]
You'd obviously want to maybe check slightly less in front. All depends on your world size mind.