MoveEntity improvement
Blitz3D Forums/Blitz3D Programming/MoveEntity improvement
| ||
hello! for my software rendered 3d engine i am looking for a MoveEntity() improvement! this is what i got yet: Function rMoveEntity(ent, x#, y#, z#) re.rEntity = Object.rEntity(ent) re\x# = re\x# + Cos(re\pitch#) * Cos(re\yaw#) * x# re\y# = re\y# + Cos(re\pitch#) * Sin(re\yaw#) * y# re\z# = re\z# + Sin(re\pitch#) * z# End Function but it doesnt work :( |
| ||
Try to send the rEntity object itself as a parameter: Function rMoveEntity(re.rEntity, x#, y#, z#) And move the mesh itself too to see any result: PositionEntity re\ent, x#, y#, z# |
| ||
Try to send the rEntity object itself as a parameter: Function rMoveEntity(re.rEntity, x#, y#, z#) this doesnt make sense, because the point is not that the object = Null And move the mesh itself too to see any result: PositionEntity re\ent, x#, y#, z# ??? |
| ||
Ok, I didn't understand it properly. What is 'ent' ? |
| ||
the entity. my problem is the calculation of the coordinates, and no other... |
| ||
I hope this does make any sense then: :)rx# = rx# + (Cos(pitch#) * z + Sin(yaw) * x) ry# = ry# + (Sin(pitch#) * z + Cos(roll) * y) rz# = rz# + (Cos(yaw) * x + Sin(roll) * y) |
| ||
hm, well, it is a lil bit better than my b*llsh*t, but it doesnt work yet sry :(... |
| ||
Yes, you are right, I thought of it too easy. After a few more tries, it now uses only the Yaw, but in a correct way. Using the Pitch and Roll should sort or less go in the same way, only using X,Y and Y,Z. I use now Yaw and Yaw+90 to calculate the direction. Maybe there is an easier way, I don't know. By the way, how is your shadow thing coming along ? |
| ||
well, thank you for help :) if someone has got an idea to make it work like i tried in the first code in this thread...please let me know ;) ps: the shadow system isn't doing much since the last 2 months because we dont know how to speed it up... don't hope on our system, it is just a demo and perhabs it will be a demo 4ever :(... |
| ||
Why not download the minib3d module for bmax, im guessing you could work it out from their using the source cos it has those type of functions. |
| ||
they are using matrices nd vectors, but not me :( |
| ||
I tried and tried, but I can't. :( So I searched some more and I found this, from jfk:xl1#=zwww(i)*Sin(gamma)+xwww(i)*Cos(gamma) yl1#=ywww(i) zl1#=zwww(i)*Cos(gamma)-xwww(i)*Sin(gamma) xl2#=xl1 yl2#=yl1*Cos(beta)-zl1*Sin(beta) zl2#=yl1*Sin(beta)+zl1*Cos(beta) xl3#=(yl2*Sin(alpha)+xl2*Cos(alpha)) yl3#=(yl2*Cos(alpha)-xl2*Sin(alpha)) zl3#=(zl2) It is from his 3d engine in the code archives: http://www.blitzbasic.com/codearcs/codearcs.php?code=418 |
| ||
well, i don't know what this is, but i have got s.th like this put into my engine, and it doesnt work :( edit: here is what i got yet http://www.blitzbasic.com/gallery/view_pic.php?id=1384&gallery=&page=1 |
| ||
Today, I'm not at home. This code seems to do the right thing, but I can only get it to work on 2 angles (it is one more allready!). Here is the source: The third angle works, but it somehow goes in the wrong direction. This code applies each angle of rotation (pitch/yaw/roll) one by one, which is the right way to do it, at least, that is what I've read somewhere. |
| ||
it doesnt :( |
| ||
I see what you mean, it is because the three angles affect each other. When Roll=180, the Yaw works upside down. As long as the three angles are not handled correctly, the function will give strange results. |
| ||
. |