Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Transform Object independent of Orientation [Re: Pappenheimer] #254320
03/02/09 15:36
03/02/09 15:36
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

Joined: Jul 2008
Posts: 894
yeah wink

The main point is that there is a mathematical possiblity (for 100% - i could swear that.. - I mean.. look at all the other wysiwyg editors out there. They all have the possiblity to scale independent of orientation - without actually editing the model) to scale an object with the scale_x/y/z values independent of it's world angle-orientation.

I do not want to edit the mdl file - as written above - but i want to edit the scale_x/y/z values (which are of course saved in the wmp file, and therefore also visible for the user).

hmm maybe i'll still have to look a little bit in the topic rotation matrix..

Re: Transform Object independent of Orientation [Re: Pappenheimer] #254321
03/02/09 15:38
03/02/09 15:38
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
you can't change the order in which gamestudio applies position, rotation and scale. first the model vertices get scaled, then rotated, then positioned in the world.

but i think you could overwrite the model's transformation matrix with your own (where you do the scaling after the rotation) in a material event before rendering.

Re: Transform Object independent of Orientation [Re: ventilator] #254338
03/02/09 17:15
03/02/09 17:15
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

Joined: Jul 2008
Posts: 894
okay finally solved.. Thanks to FlorianP
If anything is interested here's the code:

Scale Factor for rotation around the Z Axis:
Code:
m_factor.x = sinv(WIP_entity->tilt);
m_factor.y = (var)cosv(WIP_entity->tilt)*sinv(WIP_entity->roll);
m_factor.z = -1*(var)cosv(WIP_entity->tilt)*cosv(WIP_entity->roll);


Y Axis
Code:
m_factor.x = -1*(var)sinv(WIP_entity->pan)*cosv(WIP_entity->tilt);
m_factor.y = -1*((var)sinv(WIP_entity->pan)*(var)sinv(WIP_entity->tilt)*(var)sinv(WIP_entity->roll) + (var)cosv(WIP_entity->pan)*(var)cosv(WIP_entity->roll));
m_factor.z = -1*((var)sinv(WIP_entity->pan)*(var)sinv(WIP_entity->tilt)*(var)cosv(WIP_entity->roll) + (var)cosv(WIP_entity->pan)*(var)sinv(WIP_entity->roll));


X-Axis
Code:

m_factor.x = -1*(var)cosv(WIP_entity->pan)*cosv(WIP_entity->tilt);
m_factor.y = *((var)cosv(WIP_entity->pan)*(var)sinv(WIP_entity->tilt)*(var)sinv(WIP_entity->roll) - (var)sinv(WIP_entity->pan)*(var)cosv(WIP_entity->roll));
m_factor.z = -1*((var)cosv(WIP_entity->pan)*(var)sinv(WIP_entity->tilt)*(var)cosv(WIP_entity->roll) + (var)sinv(WIP_entity->pan)*(var)sinv(WIP_entity->roll));


reference matrix:

greetings

Re: Transform Object independent of Orientation [Re: TechMuc] #254340
03/02/09 17:27
03/02/09 17:27
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Isnt this the same as vec_to_ent(m_factor,WIP_entity)? Just an idea...

Re: Transform Object independent of Orientation [Re: Tobias] #254341
03/02/09 17:30
03/02/09 17:30
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

Joined: Jul 2008
Posts: 894
to be honest: i have no idea.
I've tried vec_to_ent (before i've tried this damn rot. matrix) but didn't get a working result.

Maybe i was just to dumb to use vec_to_ent correctly? no idea..

Re: Transform Object independent of Orientation [Re: TechMuc] #254343
03/02/09 17:37
03/02/09 17:37
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
hm... i don't understand your solution. smile can you post a screenshot of what it does?

maybe i misunderstood what you want to achieve but i can't imagine how scaling along the global axes can be done without your own transformation matrix.

Re: Transform Object independent of Orientation [Re: ventilator] #254344
03/02/09 17:45
03/02/09 17:45
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

Joined: Jul 2008
Posts: 894
okay.. BTW: this matrix above is my own rotation matrix. You can test it yourself smile

pan = 0, tilt = 0, roll = 0
==> normal scaling via z axis

==>

tilt = 90. pan = 0, roll = 0.
That's the normal result (very strange as you move the mouse upwards the z axis and therefore expect that the models sizes in z axis direction)

=>

I want to achieve the following:

=>

With the matrix above this works perfect (ofc also with more complex pan/tilt/roll values).


Last edited by TechMuc; 03/02/09 17:49.
Re: Transform Object independent of Orientation [Re: TechMuc] #254345
03/02/09 17:48
03/02/09 17:48
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
but what does your solution do if the angle is 45°? a global scale would skew the model but i don't see how your solution can do that.

Re: Transform Object independent of Orientation [Re: ventilator] #254346
03/02/09 17:54
03/02/09 17:54
Joined: Jul 2008
Posts: 894
T
TechMuc Offline OP
User
TechMuc  Offline OP
User
T

Joined: Jul 2008
Posts: 894
pan = 45

normal
==>

my solution
==>

i admit that it's not exactly for 100% what i wanted but in my eyes it looks a lot better (if you see it with your own eyes while scaling).
But for all those who dislike the global axis feature, i'll implement an option to switch back to local axis transformations.

Re: Transform Object independent of Orientation [Re: TechMuc] #254347
03/02/09 17:56
03/02/09 17:56
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
if you calculated a complete transformation matrix in the proper order (rotate*scale*translate) it would do exactly what you want.

but then the user who uses such objects in his projects would have to use this custom matrix code too because gamestudio can't do this by default. so i am not sure if it would make sense to include this feature in your editor.

Page 2 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1