Page 1 of 2
3D Programming Rotate/Turn Move/MoveLocal
Posted: Sat Sep 22, 2012 1:40 pm
by Thade
Additional to RotateNode RotateEntitiy RotateLight, etc ...
We urgently need TurnNode TurnEntity TurnLight, etc ...
At present we have to calculate the new angles and positions with polar coordinates ourselves for turning an attached Entity, Node or Light when the parent Node is already tilted. At least I do it, because I see no Command which does it for me. Some other Languages consider that and make a difference between rotating an turning ...
Rotating around the Y-Axis is not the same as Turning around the Y-Axis when the Node has changed the angles before.
RotateNode is a global Rotation - TurnNode should be a local Rotation, no matter what the global angles are ...
The same goes for MoveNode MoveEntity - we need TranslateNode TranslateEntity
Translate should be a global Movement (as Move is now) - Move a local Movement, no matter how the angles of Node or Entity are ...
Explanation: If an Entity (i.e. a Soldier) lies on its back on a flat plane, Translate along the Y-Axis will lift it up - Move along the Y-Axis will slide it on the ground in the direction of its head.
Edited:
To change Move to Translate would of cause make trouble - so MoveLocal or something similar added would do as well ...
Re: 3D Programming Rotate/Turn Translate/Move
Posted: Sat Sep 22, 2012 2:54 pm
by STARGÅTE
The easiest would be if Get/SetObjectMatrix(ObjectID) return/set the 4x4 matrix which includesthe whole transformation.
Then you can edit it in your way (global/local, absolute/relativ, rotation/translation/scaling...) and replace.
Therefore we don't need an individually command for any change.
Re: 3D Programming Rotate/Turn Translate/Move
Posted: Sat Sep 22, 2012 3:21 pm
by Thade
It's not the same ...
And even if YOU don't need it - WE need it - Let others decide if WE need it
Another point is because other languages have it - and the developers have obviously had something in mind when they put it in ...
So if you don't see the advantage - just try it in other languages and you will see it right away

Re: 3D Programming Rotate/Turn Translate/Move
Posted: Sat Sep 22, 2012 3:29 pm
by DarkDragon
Thade wrote:It's not the same ...
And even if YOU don't need it - WE need it - Let others decide if WE need it
Another point is because other languages have it - and the developers have obviously had something in mind when they put it in ...
So if you don't see the advantage because you have no imagination - just try it in other languages and you will see it right away

I've tried many frameworks in many languages, but I've never liked too much abstraction of the transformations. The jmonkeyengine and XNA are really good examples on how to do it right. Only physics engines are limiting movement, as unlimited movement could lead to heavy calculations. But it should depend on the user if he needs a physics engine or not.
However, we can't decide on this as you already noticed. Fred has to decide, he is the PB master.
Re: 3D Programming Rotate/Turn Translate/Move
Posted: Sat Sep 22, 2012 3:42 pm
by Thade
DarkDragon wrote:However, we can't decide on this as you already noticed. Fred has to decide, he is the PB master.
You're absolutely right
Little example to see the advantage?
CreateSphere call it Sun
CreateSphere call it Earth
CreateSphere call it Moon
CreateNodes for each
Attach the nodes as needed
Tilt Earth and Earthnode by 23 degrees ...
And then start the movements without Turn - only with Rotate ... No chance ... you need tons of additional code to make it ...
Instead you need only one Command: TurnNode
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Sat Sep 22, 2012 4:14 pm
by STARGÅTE
I think you need a function like MakeMeAGoodGame() ^^
Create a new node and attach sun with earth. Then you need only rotate!
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Sat Sep 22, 2012 4:34 pm
by Thade
Stargate, You don't get it - so no need to continue that useless discussion ...
And when you want to compare who made better and more games during the last 30 years ... pm me and I'll show you

Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Sat Sep 22, 2012 4:51 pm
by STARGÅTE
I am current not at home. So i post later a example for your sun-earth-moon example
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Sat Sep 22, 2012 5:04 pm
by Polo
I haven't read everything but shouldn't RotateEntity with PB_Relative do what you want to?
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Sat Sep 22, 2012 5:37 pm
by Thade
Polo wrote:I haven't read everything but shouldn't RotateEntity with PB_Relative do what you want to?
No - this does not change from global rotation to local rotation.
EDIT:
Another Explanation for what it's a must to have it!
Imagine you have a game where a spaceship is turning and moving
Without MoveEntityLocal and TurnEntityLocal you have to calculate the rotation and then the new Position in global space where to move to. You can do it with Quaternions and Vectors or with Polar-Coordinates - anyway - two Procedures (which everybody has to code himself) with a lot of code is needed.
Instead you could only use
TurnEntity(#Entity, 0, 1, 0) to turn around the Y-Axis - no matter where (PositionX Y Z) and how (Rotation Pitch Yaw Roll) in Space your Spaceship is located - and to Move it forward its always along the Z-Direction
MoveEntityLocal(#Entity, 0, 0, 1.5)
Want to tilt your ship over the right wing? No problem - Always turn around the Z-Axis
TurnEntity(#Entity, 0, 0, 0.5)
Me above wrote:two Procedures (which everybody has to code himself) with a lot of code is needed.
Conclusion - you do not need any Command - you can code everything yourself!
Would have the advantage that the amount of competitors in the game industry would radically drop!
http://www.fastgraph.com/makegames/3dro ... dsrce.html
Everybody can write his own commands with this and other examples you find in the internet ...
But that's not the idea behind a 3D-Engine in a great Language like PB has developed to - as more native Commands you get and which you do not have to code yourself is better!

It's relative easy for Fred to implement and then everybody can use it. Instead of everybody learns matrix multiplications, transformations, etc. and then has to add self written (probably not so fast) Procedures ...
.
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Sun Sep 23, 2012 12:07 am
by STARGÅTE
Imagine you have a game where a spaceship is turning and moving
Without MoveEntityLocal and TurnEntityLocal you have to calculate the rotation and then the new Position in global space where to move to. You can do it with Quaternions and Vectors or with Polar-Coordinates - anyway - two Procedures (which everybody has to code himself) with a lot of code is needed.
Here I agree with you! MoveEntity() current is always global and the direction is the same no matter how the rotation is.
So we need only one function : Rotate and Move, but we need a flag with constants like:
#PB_World = 8
#PB_ParentNode = 4
#PB_Local = 2
#PB_Relative = 1
#PB_Absolute = 0
which can then be combined like:
Rotate(..., #PB_Absolute|#PB_World) - absolute rotation in the world system
Move(..., #PB_Relative|#PB_Local) - relativ translation in the local system
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Sun Sep 23, 2012 1:50 am
by Thade
Actually I also had both Variants in Mind. New Commands or Old Commands with parameters for Local and Global
And I was quite annoyed about your comment - because I have made quite a lot of good games and was well aware what is needed and I knew what I was talking about - you obviously did not in this case ...
STARGÅTE wrote:I think you need a function like MakeMeAGoodGame() ^^
Create a new node and attach sun with earth. Then you need only rotate!
STARGÅTE wrote:Here I agree with you! MoveEntity() current is always global and the direction is the same no matter how the rotation is.
As I see you have noticed that its impossible to make the needed rotations and movements with the existing Commands - it works indeed only with many additional Procedures.
Personally I decided myself for the New Command Variant, because its more natural and widely used in other languages.
It will anyway be up to Fred to find the best solution - he is the master of code and knows best how it fits to the rest.
But it is quite urgently needed for everybody who wants to create 3D-Games with this great new opportunity PB 5.0 ...
... which has evolved to a really easy and effective tool for 3D-Games-Programmers
MoveLocal and RotateLocal is - for me as a game programmer since centuries - many times more often used in 3D-Games than the existing Global-Commands
That's why I started the Feature Request!
I use now a plugin with 880 lines of code which does all matrix math for the missing Commands ...

I converted the C++ Lib (see the link above) to PB after I started this Thread ...
.
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Wed Sep 26, 2012 10:26 am
by Comtois
STARGÅTE wrote:
Here I agree with you! MoveEntity() current is always global and the direction is the same no matter how the rotation is.
So we need only one function : Rotate and Move, but we need a flag with constants like:
#PB_World = 8
#PB_ParentNode = 4
#PB_Local = 2
#PB_Relative = 1
#PB_Absolute = 0
which can then be combined like:
Rotate(..., #PB_Absolute|#PB_World) - absolute rotation in the world system
Move(..., #PB_Relative|#PB_Local) - relativ translation in the local system
For the moment it is possible for Rotate using these constants
#PB_Engine3D_Space_Local=1
#PB_Engine3D_Space_Parent=2
#PB_Engine3D_Space_World=4
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Wed Sep 26, 2012 1:06 pm
by STARGÅTE
Comtois wrote:For the moment it is possible for Rotate using these constants
#PB_Engine3D_Space_Local=1
#PB_Engine3D_Space_Parent=2
#PB_Engine3D_Space_World=4
Is there a documentation which justifies these definitions?
Re: 3D Programming Rotate/Turn Move/MoveLocal
Posted: Wed Sep 26, 2012 1:32 pm
by Comtois
STARGÅTE wrote:Comtois wrote:For the moment it is possible for Rotate using these constants
#PB_Engine3D_Space_Local=1
#PB_Engine3D_Space_Parent=2
#PB_Engine3D_Space_World=4
Is there a documentation which justifies these definitions?
Not yet.
Well and i'm wrong , constants are :
#PB_Engine3D_Space_Local=2
#PB_Engine3D_Space_Parent=4
#PB_Engine3D_Space_World=8