Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (799)
Games in Android Showcase (236)
games submitted by our members
Games in WIP (865)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [engine] How to represent object transforms  (Read 1233 times)
0 Members and 1 Guest are viewing this topic.
Offline Ecumene

JGO Kernel


Medals: 200
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Posted 2014-11-02 19:27:54 »

I am developing a very simple game engine, and I am going through the different requirements for the physics/collision, and the lighting and such. And I have come to the conclusion that every game entity requires a 4x4 object matrix for graphics. Although, some systems like physics, and collision require a 3 component vector to a point in space, representing a translation. My problem is, should I handle each entity of having a Matrix4 for it's object-space transform, or should I have vec3s for translation, rotation, and scale, then calculate a matrix for them each frame? Or is this bad practice/CPU intensive?

Offline pitbuller
« Reply #1 - Posted 2014-11-02 19:36:51 »

Store them in decomposed states. This use less memory(16floats vs 8/10(vec3 pos, quaternion orientation, vec1/3 scale)
This way you can also avoid problems related to interpolated rotations, inverse transforms etc. Composing matrix from these hardly use any cpu cycles.
https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/math/Matrix4.java#L222
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (181 views)
2019-09-04 15:33:17

hadezbladez (4820 views)
2018-11-16 13:46:03

hadezbladez (1774 views)
2018-11-16 13:41:33

hadezbladez (5100 views)
2018-11-16 13:35:35

hadezbladez (1011 views)
2018-11-16 13:32:03

EgonOlsen (4351 views)
2018-06-10 19:43:48

EgonOlsen (5207 views)
2018-06-10 19:43:44

EgonOlsen (2938 views)
2018-06-10 19:43:20

DesertCoockie (3863 views)
2018-05-13 18:23:11

nelsongames (4287 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!