Climb Up Ramp Collision?

Blitz3D Forums/Blitz3D Programming/Climb Up Ramp Collision?

RustyKristi(Posted 2016) [#1]
Hi, I would like to know how this works with default B3D collisions. I tried all methods but I can't seem to get my player go climb up in a ramp platform.

Thanks


RemiD(Posted 2016) [#2]
What do you mean by a "ramp platform"


Rick Nasher(Posted 2016) [#3]
If you're talking about smooth obstacles or ramps, simply use linepick.
If you mean ladders then check:
C:\Program Files (x86)\Blitz3D\samples\si\fps

(which includes ramps/slopes also btw)


Floyd(Posted 2016) [#4]
\samples\mak\castle has ramps.


Guy Fawkes(Posted 2016) [#5]
Yea, pain in the *** ramps that keep you sliding slowly -.-

~GF


Rick Nasher(Posted 2016) [#6]
With collisions yes indeed. That's why I use linepick - learned the hard way ;-)


Guy Fawkes(Posted 2016) [#7]
Care to share a bit of example code in 3D to show us how you do that, @Nasher?

Thanks! =)

~GF


Rick Nasher(Posted 2016) [#8]
Sure, nothing suitable for publishing, will have to pull out, no can't do right now, but doesn't the multiplayer example contain similar code(fake gravity with linepick and a ramp)?


(need to sleep. what am I doing here at 1:20 in the morning? I guess it's addiction.. :-) ltrs..


RustyKristi(Posted 2016) [#9]
Thanks guys. I know about linepick but it would probably easy with a basic example.

@Rick Nasher
I see that one but kinda confused how that works. I noticed it uses collisions command with the linepick :/ ( lol, ok get some sleep! thanks and see ya in the morning :)

I would appreciate reading a simpler code like the ones you see in the online manual. thanks

@RemiD

That pic above right there is one example


RemiD(Posted 2016) [#10]
@RustyKristi>>oh you mean a slope.

Not sure what is the difficulty with this.
What i do is that i separate the detection of the obstacles below (terrains, floors), above (ceilings), and the detection of the obstacles at front, back, left, right.

This means that each loop, for each turningmoving character/vehicle there are 2 translations, first one up/down, then one front/back/left/right. (or the other way around)

Also keep in mind that you can manage collision detection and repositionning with a combination of linepicks + pickables and ellipsoids + collidables or only with linepicks + pickables.

Just make sure that the pickables/collidables are low details meshes and it will be fast enough...


The example that Rick proposes is really primitive imo...


Rick Nasher(Posted 2016) [#11]
@RemiD
Actually.. sort of regarding the same topic: collisions & gravity.

Using the code example I mentioned, I'd like to reduce health when falling and die when from a too high cliff, but I can't seem to get it to detect these situations above without errors. I mean it works, but also kills the player when running down a ramp, it somehow sees this as gravity too.

Any idea's on how to achieve something like this?


RustyKristi(Posted 2016) [#12]
@RemiD

Actually, I tried the UDP example that Rick pointed out and it is something that I am looking for but I can't seem to put it all together to build a basic example from that.


RemiD(Posted 2016) [#13]
@Rick and RustyKristy>>
Try to separate the movement and the detection of the obstacles at front,back,left,right (with ellipsoids and collidables) ; and the movement and the detection of the obstacles at up,down (with linepick and pickables)

Your problem is probably because you use only one ellipsoid and you turnmove this ellipsoid (which can't go through obstacles) instead of using a pivot (with childs ellipsoids) and you turnmove this pivot (which can go through obstacles) (but still detect collisions with the environment thanks to the childs ellipsoids).


RustyKristi(Posted 2016) [#14]
Thanks, can you put a very basic example at least as I would like to learn from it?

Also problem with shapes if you have a rectangular object like a car and you try to climb it, I guess you have to fake the pitch of your mesh so it does not look weird? This is not a problem with humanoid meshes or objects that take less space.


Rick Nasher(Posted 2016) [#15]
@RemiD
My problem isn't the same for it's detection and collision system is working fine in general.

Only issue is that I want add the ability to destinquish between a high drop and normal colisions. High drops deducting health/energy and even higher causing death.

I thought it would be piece of cake but actually isn't( I'm probably on the wrong track). When is a dropt a too high drop? I thought about using: if 'gravity vector velocityY' > maxthreshold, but apparentlty this increases also rapidly when running down a ramp, causing sudden death. :-(

I just know this should be very simple to do as I used it in the past, many years ago. Forgot how I did it though.


Guy Fawkes(Posted 2016) [#16]
> maxthreshold / 2


Rick Nasher(Posted 2016) [#17]
Dunno how that would work GF. Nevertheless, it actually made me think about reality:
In real life falling is always faster than running down a ramp.
Hence the situation in the game. Where it's the opposite.


RemiD(Posted 2016) [#18]
@RustyKristi>>
I am not in a coding mood and i don't want to spend time on that for the moment, but i will try to find an old code example to illustrate what i mean.


@Rick>>What you want is easy to make, you simply have one variable for each character for example character_gravityspeed# and when the character is falling, this value increase (or decrease depending on how you want to code it) and the higher the absolute value, the bigger the damage when the character is landing on the ground.


RemiD(Posted 2016) [#19]
with one pivot + several childs ellipsoids + collidables (using Blitz3d collision system) :



RemiD(Posted 2016) [#20]
with one pivot + several linepicks + pickables (using Blitz3d linepick system) :
rd-stuff.fr/one-pivot+several-linepicks+pickables-code-example.bb

this one i will delete it in a few days (because i will probably reuse the code later), so download it while you can !


RemiD(Posted 2016) [#21]
Have fun figuring it out ! :P


Guy Fawkes(Posted 2016) [#22]
You know what, Remi? I'll modify this code for him, AND I will be posting it FOR ALL TO SEE because you are nothing to me! Do NOT talk to Remi anymore, @RustiKrusti, he's a royal PAIN in EVERYONE's @5*!

Here's the original code ::



~GF


Rick Nasher(Posted 2016) [#23]
Lol
Moved my replies here:
http://www.blitzbasic.com/Community/posts.php?topic=104840#1306157
Don't want to highjack/ride a thread more than I should. ;-)


Rick Nasher(Posted 2016) [#24]
Wait a minute..Huh? GF? what did I miss? besides RemiD doesn't want to play along and posting incomplete code? ;-)
Btw: the one you posted also nogo(yet).

@RemiD
Afaics, your code doesn't contain jumping or moving onto objects.
Just detection of objects, so not particularly useful for moving up a ramp I'd say.


Guy Fawkes(Posted 2016) [#25]
HAHAHAHAHA! NICE one, Nasher! =D

~GF


RustyKristi(Posted 2016) [#26]
@RemiD

Thanks for that, it did work but I don't see any ramps in the scene to test it out.

@GF
Yes, as RickNasher said it doesnt work but thank you for adding more


Guy Fawkes(Posted 2016) [#27]
Here's the working version if you guys wanna fix the camera, the jump, & the player.



Enjoy!

~GF


RemiD(Posted 2016) [#28]

I will be posting it FOR ALL TO SEE because you are nothing to me!


@GF>>I feel the same about you, as you already know :D

I don't really care that you post it for others to see, only those who have a good enough level will be able to understand it and to use it (=not you)


@Rick>>The example with linepicks and pickables has jumping, falling, but not sliding (because i had a problem with the picked normal values, not sure why)


Anyway it shows 2 alternative ways to manage collisions.


RemiD(Posted 2016) [#29]

if you guys wanna fix the camera, the jump, & the player.


Some things never change... Ahahah


RemiD(Posted 2016) [#30]
(GF modified my code, now the example he posted does not work anymore, nothing surprising...)


Guy Fawkes(Posted 2016) [#31]
.


RemiD(Posted 2016) [#32]
Oh my mistake, a part of the code is missing.
Please redownload in a moment.


@GF>>remove your codes i will reupload the full working code so that you can steal it.


Guy Fawkes(Posted 2016) [#33]
.


RemiD(Posted 2016) [#34]
Here : rd-stuff.fr/one-pivot+several-linepicks+pickables-code-example.bb

The controls are :
mouse xaxis to turn left right
mouse yaxis to look up down
zqsd to move front back left right
mouse wheel to increase or decrease movement speed
hold space to charge jump
release space to jump
left ctrl to crouch
left shift to stand

the others things i don't remember, read the code...


RemiD(Posted 2016) [#35]
In this code example (one-pivot+several-linepicks+pickables), there are slopes, but you can only move on those who have a slope between 0° and 45°, because between 45° and 90° the character was supposed to automatically slide down the slope. However this is where i stopped to code this because there was a problem with the picked normal values...

Maybe GF will fix it ?


RustyKristi(Posted 2016) [#36]
Thanks RemiD, that was an awesome demo! :D In fact, by looking at those game components you can actually make a game with it. nice!

Apparently atm I just need a really really basic example to figure it out, a ground, ramp + player will do. The added terrain is another bonus. I just need to dissect what is happening under the hood.

Thank you again, that looks really cool. I might use it as a base for later demos if you have no restrictions with it.


RustyKristi(Posted 2016) [#37]
If it's still hard to come up with an alternative, I think RickNasher's code will do just fine for now. I stripped down just the basics so I can test some stuff with it and see if it fits with what I'm trying to do.

On a separate question, how do you get the inclination of a surface with the linepick collision so your object follows the angle or steepness, ie terrain?


Rick Nasher(Posted 2016) [#38]
@RustiKristi
Search for AlignToVector , it normally does the trick.
I think you would have to use something like this:

LinePick( EntityX( player ), EntityY( player ), EntityZ( player ), EntityX( objecttoalignto ) - EntityX( player ), EntityY( objecttoalignto ) - EntityY( player ), EntityZ( objecttoalignto ) - EntityZ( player ) )
AlignToVector( player, PickedNX(), PickedNY(), PickedNZ(), 2, 1 )

@RemiD
Ah, you noticed it was missing a few major routines. Tssk tssk. Thought like GF, you were pulling someone's leg here. :-)

Besides: at 2nd glance I noticed some vital things were missing from the multiplayer code. I don't know how I was thinking it would ever work while only using linepick in the follow cam and jumping sections.. Aarrghh
[Rick beating himself over the head with a fat, large, rotten fish]


RemiD(Posted 2016) [#39]
@All>>Yes you can use this code as it is or modify it for your projects, no restriction, i don't care, only those who have a good enough understanding and skill will be able to anyway ! :)


Also one tip concerning movement on slopes or crossing small obstacles (lower than the knee level) or movement on a terrain with hills and deeps or irregular ground :
you can use linepick to detect where the ground is related to the player root, and if it is farer ("further" ?) than the distance between the root and the knee, calculate and apply gravity, but if it is between the root and the knee, directly position the character on the ground. This allows movement on irregular terrains/small obstacles without "jerky falling".


RemiD(Posted 2016) [#40]
Here is another example with one pivot + one ellipsoid + collidables, so that Rick can finally realize the superiority of my code and my awesomeness (just joking this code is old and primitive) :

Apparently, in this code i turnmove the ellipsoid and the rest of the character follows (works for simple games only, you can't create a tomb raider/indiana jones with that !)
You can grab the ladder only if the character is oriented towards enough, and then climb up down letgo...


Rick Nasher(Posted 2016) [#41]
Hehehe, thanks but already solved the issue(sometimes it stares you right in the face). Had to extend sensitivity of linepick also. Silly really.
Many thanks though. Your initial response was correct.
See: http://www.blitzbasic.com/Community/post.php?topic=105608&post=1306228

Btw: interesting fx with all the transparency, but kinda hard to maneuver.
Like the ladder thingy etc in 2nd example. Similar to the fps example in Blitz examples(the one with the gargoyle and stuff).


RemiD(Posted 2016) [#42]
@Rick>>about linepick length and radius, you may want to read this : http://www.blitzbasic.co.nz/Community/posts.php?topic=104372 (post#8)


Rick Nasher(Posted 2016) [#43]
I know, read it before. ;-) thanks.


Guy Fawkes(Posted 2016) [#44]
Ya know, Remi? You're a mean little t**t. I feel sorry for you... You can label me all you want, but it means NOTHING to me. Labeling is just a means of control & I have just removed your control. How does it feel to lose?

Have a good day.

~GF


RustyKristi(Posted 2016) [#45]
GF, We're here to collaborate and not make enemies. There's a lot of social media platforms out there in case you want to pursue making friends or enemies, twitter facebook instagram, take your pick.

If the guy hates your guts, there's nothing you can do. Throwing insults with that last comment does not make any difference at all. So I would suggest stop doing these childish acts and move on.

Sometimes I don't agree or have differences of opinion with RemiD, Nasher or other guys but I don't take any offense on that because I'm here to learn and if I know something I would share it in return. It's normal but still they provide help and knowledge and I truly appreciate that. If you don't then maybe there's something wrong with you.

Please don't hijack this thread with your insults GF and move on, it's kind of disruptive.


RustyKristi(Posted 2016) [#46]
@RemiD

Thanks for the last example, it's much better now and I think I can get some ideas there. So the same applies with the ramp and a terrain?

Search for AlignToVector , it normally does the trick.
I think you would have to use something like this:

LinePick( EntityX( player ), EntityY( player ), EntityZ( player ), EntityX( objecttoalignto ) - EntityX( player ), EntityY( objecttoalignto ) - EntityY( player ), EntityZ( objecttoalignto ) - EntityZ( player ) )
AlignToVector( player, PickedNX(), PickedNY(), PickedNZ(), 2, 1 )



Ok RickNasher, I'll check this with the UDP example you already got which is working for me. thanks


Guy Fawkes(Posted 2016) [#47]
RustiKrusti, I defend you & this is the thanks I get? I'm out of here...


RustyKristi(Posted 2016) [#48]
GF, first off I have no qualms with anyone here, so I'm not sure why you are defending me in the first place.. but thanks anyway.


RemiD(Posted 2016) [#49]

If the guy hates your guts, there's nothing you can do.


I don't hate GF or anybody, i have difficulties to tolerate high level of stupidity/nonsense. (low level are ok, i am stupid too sometimes)


@GF>>Steal the code and fix it, improve it ! Show us how it is done by the master of Blitz3d.


How does it feel to lose?


Oh nooo !


RemiD(Posted 2016) [#50]
@RustyKristi>>The more recent code and what i would use would be the example with one pivot + several linepicks + pickables because it is flexible (i can organize the code how i want, no need for updateworld, and i can use it per turning moving entity for a step by step collision system (like in the example))
I have created another game prototype using the same system, but this time for a flying ship shape and it works reliably and is fast enough.

But it is probably reliable enough to use a system with one pivot + several ellipsoids + collidables to detect the obstacles at front,back,left,right, and one pivot + one linepick + pickables to detect the ground

The difficulty you may encounter when using ellipsoids + collidables is that even if you use the collision response "stop" sometimes an ellipsoid goes through a collidable so then how can you reposition the turning moving entity precisely if you can't rely on the collision detection ? Hence the system with several linepicks + pickables


RustyKristi(Posted 2016) [#51]
Thanks RemiD, I will look into that.


Cocopino(Posted 2016) [#52]
Linepicks are slow, it's not likely you can use linepicks for everything and still achieve a decent framerate having multiple moving characters/objects, unless you keep the scenery very basic.

Also, imitating gravity can be a pain in the behind (e.g. the "bullet through paper" problem among many other problems).
Why not use a physics engine?


RustyKristi(Posted 2016) [#53]
Linepicks are slow, it's not likely you can use linepicks for everything and still achieve a decent framerate having multiple moving characters/objects, unless you keep the scenery very basic.


Interesting, maybe not use the actual model as collisions and have a low poly with alpha instead?


RemiD(Posted 2016) [#54]

Linepicks are slow, it's not likely you can use linepicks for everything and still achieve a decent framerate having multiple moving characters/objects


my code example demonstrates the contrary, it depends on how you use linepick(s) (preferably after a distance check, and with low tris shapes for pickables)


Cocopino(Posted 2016) [#55]
Well, not only that, you'll need all kinds of optimizations to be able to use linepicks as a collision system in a real game running at an acceptable speed. Which is why I suggested using a physics engine ;)


Cocopino(Posted 2016) [#56]
my code example demonstrates the contrary


I have not looked at your code but yes, you might manage to speed up linepick by enforcing restraints (entitydistance being a very important one). I highly doubt however it will run even remotely close to the speed a good physics engine would, especially when the scene gets crowded with lots of objects.
Reason being: a physics engine has all these optimizations already built in.


RemiD(Posted 2016) [#57]
My comment was only to contradict your statement that "Linepicks are slow", it depends on how it is used...

Before doing a distance check to determine if a pickable must be considered or not, you could also have your map divided in areas so that you would only consider the pickables in the area where the character/vehicle is and those in the areas connected to this area. (=less distance checks, then less pickables to consider, then fast linepicks)

The same system can also be used to determine which surfaces must be hidden/shown before rendering.


A physics engine can also be slow depending on how it is used (especially if you have many turning moving bodies and you don't reset the angularvelocity and linearvelocity of the turning moving bodies and deactivate them below a low enough threshold).


_PJ_(Posted 2016) [#58]
Really I think arguments concerning speed of linepicks vs speed of physics engine is rather subjective and highly context-dependant.

A physics engine may be much faster processing the collision and sliding motions of moving up/down ramps compared to linepicking the object every frame, yet Physics engines are not restricted ONLY to this implementation and perform numerous other calculations on numerous other entities regardless of whether those entities may be in the range/direction of a linepick etc.

If a physics engine of sorts is already implemented and in use then by all means it would probably be most efficient to utilise that functionality to handle moving along ramps - since the calculations will be performed regardless.

HOWEVER, if this is not the case, then Linepicking to identify the ramp and/or gradient is an ideal and fast enough method to handle most typical examples and will not be slowed down by the existence of unrelated objects that lie beyond or away from the pick radius and direciton.


RustyKristi(Posted 2016) [#59]
Yes, as I stated on this thread question, I can only use standard B3D functions and not include any libraries such as physx or bullet.

If that will be the case then I would not be asking for it anymore since the physics engine will do that for me, given the proper setup.


Cocopino(Posted 2016) [#60]
Sorry, might have jumped to conclusions. I just scanned the thread and saw words like these:
collisions, gravity, vector, gravityspeed, jumping, MMO, etc


Rolling your own physics simulator might prove a hell of a job... But if it works for you, it works for you :)


RustyKristi(Posted 2016) [#61]
yeah its just for basic physics and gameplay stuff, nothing serious.

As for the mmo part, I did not even notice but that yea it was GF which btw was not even close to what we have been discussing. He's just trolling RemiD as usual.

thanks for the input. :)


Guy Fawkes(Posted 2016) [#62]
.


RustyKristi(Posted 2016) [#63]
You should remove that comment before some admin or SkidRacer sees that. Do you want to be banned?

Read your comment #31 and tell me if you're not trolling. I'm seeking help and we're having a discussion about this custom physics and you're mocking somebody in the middle of it.

Man, you're totally out of place. Be polite and calm down.