linepicks & collisions

Blitz3D Forums/Blitz3D Beginners Area/linepicks & collisions

Aussie(Posted 2010) [#1]
Gday all,
I am useing linepicks & collisions together & am having a few problems.

From what i can inderstand a linepick will cast a line from a specified point, say ( Entityx(blah),Entityy(blah),Entityz(blah) ) that being point 0,0,0 of that entity and will then cast the line at a specified distance along the X,Y,Z axis from that entity, say ( 0,0,1 ) will cast a line of 1 unit in length along the z axis of that entity?

Pickedx(),Pickedy(),PickedZ() will return a point that has been picked in a global position? Say if the entity is picking along its Z axis but is aligned to the X world axis the Pickedx() would return a value & not the Pickedz()
is this how the linepick works?

I am using a linepick to keep a player above the ground & to set a flag for jumping, i also want to use a linepick to keep the player away from walls because when i use normal collisions i have problems with parts of the mesh going into them & in areas where there is a step up around 1 unit in hight the collisions get all kind of jittery.

With line picks running in the z direction of the player the player keeps moving & i wouldn't think it would be picking anything as the player is more then 1 unit away from a wall.

This is the code i have so far


Other question, are there any good collision libs around. I have had a look for nuclear glory & the coldet wrapper but none of them seem to be around anymore.

Cheers :)

Last edited 2010


Yue(Posted 2010) [#2]
Hello, you need a physical library right? I recommend the Px Wrap, was paid but the operator abandoned the project and the release could now say that it is free.

http://blitzbasic.com/Community/posts.php?topic=90281


Yasha(Posted 2010) [#3]
I've emailed you a copy of ColDet, as it's always handy to have around. Pity the site went down.

Proper physics engines are definitely recommended if you want to do anything more complicated than not falling through walls though.


Aussie(Posted 2010) [#4]
Thanks Yue I do have JV-ODE & have had a bit of a play with it, i will have a go at using that for collisions. I would still like to get the linepick working correctly though.
Cheers :)


Yue(Posted 2010) [#5]
Hey Yasha please men, copy Coldet me too. my email.


Aussie(Posted 2010) [#6]
Cheers for that Yasha :)


Aussie(Posted 2010) [#7]
Just fowarded it on to you Yue.


Stevie G(Posted 2010) [#8]
@ Aussie, you're not using linepick correctly.

Firstly, you are not picking in the direction of the player. The direction vector required by the linepick command is a world coord, therefore you have to convert the vector of 0,0,1 from the players local coords to world coords and use the result.

Tformvector 0,0,1,Psphere, 0
picked = LinePick( EntityX(psphere),EntityY(psphere),EntityZ(psphere),TFormedX(), TFormedY(), TFormedZ() )


Secondly, your line pick has a zero radius. Not sure if that is an issue but wouldn't recommend it.

Thirdly, you are not actually checking to see whether the pick has hit an entity. You can move the entity away from the picked normal like so:

If picked > 0
	TranslateEntity psphere, PickedNX(), pickedny(), PickedNZ()
EndIf


Last edited 2010

Last edited 2010


Aussie(Posted 2010) [#9]
Ok

So would i be right then by saying that say
Tformvector 0,0,1,Psphere,0

Takes the 0,0,1 point of Psphere then using
Linepick(EntityX(psphere),EntityY(psphere),EntityZ(psphere),TFormedx(),TFormedy(),TFormedz())

Is casting the Linepick from Psphere,0,0,0 to where Psphere,0,0,1 local cords would be & converting Psphere,0,0,1 to a global position?


jfk EO-11110(Posted 2010) [#10]
Actually it should be TFormedX()-EntityX(psphere)

(for the dx parameter of Linepick). Not sure about the rest of it.


Stevie G(Posted 2010) [#11]

Actually it should be TFormedX()-EntityX(psphere)

(for the dx parameter of Linepick). Not sure about the rest of it.



This is wrong. Note the use of tformvector, rather than tformpoint.


Aussie(Posted 2010) [#12]
Thanks guys got it going.
Just trying to visualize whats going on. :)


jfk EO-11110(Posted 2010) [#13]
Stevie. I was just refering to the docs that are saying dx, dy and dz are the distance the line will travel. So it should be the diffrence between point A and point B. Tho, I didn't really analyze what't going on with TForming in the example here.