HomePortalFAQSearchMemberlistUsergroupsRegisterLog in
Meet the new KITO admins & hear their plans here.
You can use google search to find threads and posts here now. Example

Share | 
 

 [Guide] Make IT Read FH Rotations! (6.0)

View previous topic View next topic Go down 
AuthorMessage
Nefadozone

avatar

Game username : Nefadozone
Server : Fucko McShitpo
Male Posts : 176
Join date : 2011-11-11
Age : 23
Location : Satan's Asshole

PostSubject: [Guide] Make IT Read FH Rotations! (6.0)   Wed Oct 21, 2015 8:11 pm

I wanted to make my game just naturally read FH rotations without converting them to degrees by hand.

I thought that if I made them radians and added a quaternion thingamajig at the end of the something (have tried w.x.y.z and x.y.z.w)

that I could make this work..

well.. getting nowhere fast, if anyone knows what I'm talking about (I don't even know what I'm talking about) and/or has any ideas on how to convert the rotations away from degrees.. would like suggestions/help? I've gotten pretty close to the rotations being exact but this has been awkward for someone with no experience. I do want to do this without making up an equation.

The game currently reads positions as raw degrees right? Doesn't FH use radians or am I completely wrong?  Crying or Very sad Maybe I better know what I'm doing before I do it huh?

goodness:
 

Somewhere in MagixWorld.cpp inside of
Code:
void MagixWorld::addObject(const String &Meshname, const Vector3 &position, const Vector3 &scale, const Real &pitch, const Real &yaw, const Real &roll, const String &playSound, const String &matName)
....
if (pitch !=0)node->pitch(Degree(pitch));


Last edited by Nefadozone on Sun Oct 25, 2015 10:33 pm; edited 4 times in total
Back to top Go down
http://wildmidnight.boards.net/
Yeppermedepper

avatar

Posts : 25
Join date : 2014-11-28

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Wed Oct 21, 2015 9:21 pm

Maybe you could change the rotation of the object in blender to make it work.

Sorry if I misunderstood your post.
Back to top Go down
Nefadozone

avatar

Game username : Nefadozone
Server : Fucko McShitpo
Male Posts : 176
Join date : 2011-11-11
Age : 23
Location : Satan's Asshole

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Wed Oct 21, 2015 9:39 pm

Well that's for meshing the object itself. The problem/experiment is seeing what rotations are being used in FH and using those for objects in IT. I assumed radians only because of how large the numbers are in FH's map object configs, restating here that I have no experience with the math aspect of ogre.

I've tried a couple different combinations, now I'm trying quaternions.
Back to top Go down
http://wildmidnight.boards.net/
Yeppermedepper

avatar

Posts : 25
Join date : 2014-11-28

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Wed Oct 21, 2015 10:25 pm

I actually think that's right. I have seen the word quaternions somewhere in the source code. but it is a faint memory.

so are you making the objects rotate to the terrain or something?

Back to top Go down
Nefadozone

avatar

Game username : Nefadozone
Server : Fucko McShitpo
Male Posts : 176
Join date : 2011-11-11
Age : 23
Location : Satan's Asshole

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Wed Oct 21, 2015 11:51 pm

FH has four values in the object cfg that I'm wondering about. Assuming that it has w x y and z values, I'm attempting to make object rotations in IT the same as the ones in FH so that I can use its mapmaker. I'm more comfortable with FH's mapmaker than ogitor, ego game editor etc.

closer:
 

So far I've gotten the rotations actually really close, there are some trees on the ground so I'm going to mix and match using quaternions and if these don't work I'll try radians. I know this sounds silly to those who know this stuff but I'm trying. pale
Back to top Go down
http://wildmidnight.boards.net/
Yeppermedepper

avatar

Posts : 25
Join date : 2014-11-28

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Thu Oct 22, 2015 9:05 pm

I understand your efforts. FH's map maker is so simple.
Back to top Go down
Nefadozone

avatar

Game username : Nefadozone
Server : Fucko McShitpo
Male Posts : 176
Join date : 2011-11-11
Age : 23
Location : Satan's Asshole

PostSubject: If you want to try and see if this works..   Sun Oct 25, 2015 8:41 pm

So I think I've found a solution.. so far I haven't seen any crazy rotations or trees laying on the ground, everything seems okay-ly converted over from FH, even bushes are oriented on my hills properly now just like they were in the map maker. I'd appreciate feedback and testing to see if this works, of course the best way to test that is to place objects in FH and see if they're the same orientation in IT, but I can't be bothered to do that right now.

If you'd like to try this out here's the changes I made in the KITO 6.0 source - please back up your MagixWorld.h and MagixWorld.cpp files beforehand so if this turns out to be faulty or breaks something you can always go back to the old way.

Notes:


  • Since this uses Quaternions and not REAL Degrees (Think of it using numbers like 1.3059395 instead of 75 degrees), it isn't going to be compatible with your existing positioning - or at least it may not show up accurately. You may want to do all placement in the FH map maker.

  • This only changes the way meshes are rotated in the .world [Object] function. Bushes, Trees, and NewBushes cfg files are not effected. So this is a handy little edit to make your game work with JBRWolf's FH to IT Map Converter. (The reason why I looked into this in the first place)





The edits:

MagixWorld.h ~ln 66:
 

and

MagixWorld.cpp ~ln 233:
 

and finally

MagixWorld.cpp ~ln 944:
 

The commented code is just some leftover stuff, no need to mess with it.

Again, feedback please and thank you so I can make map making a little bit easier.

silent

EDIT: Having mixed results (The values are totally reversed, will look into this for a few more hours with setOrientation instead before giving up - I wouldn't bother with the code I posted above)

EDIT 2: Seems to be working fine!





EDIT 3: It's fine enough.. still finding things oriented strangely once they're rotated around a certain point. Not sure if there's inherited rotations going on or what. Will look into this another day, another time, because for now at least the basic aspect of this works. Would not recommend this for anything but foliage at the moment - if trees are rolled out on the ground I'd just try to set the fourth value in the .world file for the rotation line to 0 (the third line below each [Object] may have a 4th value, I'm not sure if it's the first value or the 4th value.. or even the 2nd value that's doing this) -- it goes w, x, y, z - rotation, pitch, yaw, roll, I'm sure anybody that's determined to fix it by hand could go about doing this - but hey, I tried. It's probably as functional and trustworthy as Impressive Gardener right now.. lol. No )


Last edited by Nefadozone on Sun Oct 25, 2015 11:41 pm; edited 3 times in total (Reason for editing : Well..)
Back to top Go down
http://wildmidnight.boards.net/
PorathSunGod

avatar

Game username : PorathSunGod
Server : Aircell [Owner]
Female Posts : 73
Join date : 2015-08-21
Location : Snowdin

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Thu Nov 05, 2015 6:18 pm

Lol ay, there's something stuck too your foot! xD
Back to top Go down
http://aircell.freeforums.net/
Slain Motionless

avatar

Game username : The-Hunted
Server : Aroessa
Female Posts : 431
Join date : 2014-05-09
Age : 18
Location : Coding

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Sat Nov 07, 2015 12:36 am

Very nice! Will come in handy for those whom don't understand basic IT map making. Gonna test this for myself. Let's hope I don't break anything :B
Back to top Go down
http://aroessa.proboards.com
Nefadozone

avatar

Game username : Nefadozone
Server : Fucko McShitpo
Male Posts : 176
Join date : 2011-11-11
Age : 23
Location : Satan's Asshole

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Sun Nov 08, 2015 2:34 pm

I've found that if you don't rotate the meshes too 'hard' in FH that it'll work without problems.

Hopefully either me or someone else will figure out a resolution to that issue. x_x
Back to top Go down
http://wildmidnight.boards.net/
JBRWolf
Coder
Coder
avatar

Game username : JBRWolf
Male Posts : 19
Join date : 2014-07-13
Age : 17

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Sat Nov 14, 2015 4:52 pm

Nefadozone wrote:
I've found that if you don't rotate the meshes too 'hard' in FH that it'll work without problems.

Hopefully either me or someone else will figure out a resolution to that issue. x_x

Nice work, this is a good temporary solution.
But anyway "if you don't rotate the meshes too 'hard' in FH" is probably due to the problem of gimbal lock that occurs with euler angles( the x,y,z rotation).

Anyway what you're looking to do is to convert a quaternion angle to an euler angle. When looking for a solution myself I copied the math from this site and got this result:
What it's meant to be:

What it converts to:


This appears to be a similar result to yours and may be the same, maybe you could upload your map files so I could test? If they are the same I could publish a small update update to my map converter that includes this functionality without having to change the KITO source code.

If you do find a full solution please share it.
Also you could try looking into this:

which is (meant to be) a solution that I found on this forum
The converter is made in a language called au3 so I don't have access to the orge libraries to test it. However if you test and it turns out to work I may try making a sub rotation converter in c++ and then include that into the converter.
Back to top Go down
Nefadozone

avatar

Game username : Nefadozone
Server : Fucko McShitpo
Male Posts : 176
Join date : 2011-11-11
Age : 23
Location : Satan's Asshole

PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   Sat Nov 14, 2015 9:13 pm

These are the maps I used to test it

https://drive.google.com/file/d/0BwuZYMqT31uEdVotenpNcS1EMEU/view?usp=sharing

Not sure if I edited the plateau mesh or not in FH (made it so that the default scale of the mesh in the object editor was only 1 1 1, I think - so it'd look right in IT)

but I may have if it looks incorrect. I'll be looking into the maths of it all today.
Back to top Go down
http://wildmidnight.boards.net/
Sponsored content




PostSubject: Re: [Guide] Make IT Read FH Rotations! (6.0)   

Back to top Go down
 
[Guide] Make IT Read FH Rotations! (6.0)
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Keeping I.T. Open :: DOWNLOADABLE CONTENT :: Programming Features-
Jump to: