Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have an array of available gameObjects in the scene. An array of GO should be transformed according to received floats through UDP connection. I know it is simple, but can't figure it out how to accomplish the transformation an array of GO according to received unique floats for each GO, any help will be appreciated.

Here is a transformation floats, it might be helpful I guess:

x =ReadSingleBigEndian(data, signalOffset);
        signalOffset+=4;
        y= ReadSingleBigEndian(data, signalOffset);
        signalOffset+=4;
        z= ReadSingleBigEndian(data, signalOffset);
        signalOffset+=4;
        alpha= ReadSingleBigEndian(data, signalOffset);
        signalOffset+=4;
        theta= ReadSingleBigEndian(data,signalOffset);
        signalOffset+=4;
        phi= ReadSingleBigEndian(data,signalOffset);
        signalOffset+=4;

Gathering information:

All I need to do is transform an array of game objects, of course I need to use some kind of loop, but the problem is I have an array of the float values divided by offset and array of the game objects and I need to transform them by assigning float values which came through udp and each of the floats is unique and belongs to exact game object.

share|improve this question
I'm having trouble understanding what your asking here. Maybe you just need to loop over your array of game objects? Try to add some more details if you really want an answer. – Laurent Couvidou Nov 21 '12 at 14:00
You need to find documents of a matrix library. There should be methods having name like setRotationMatrix or perhaps with keywords Euler angles, which should consume greek alphabets and a 'translate' method, that consumes the x,y,z. – Aki Suihkonen Nov 21 '12 at 14:06
@LaurentCouvidou, what exactly you didn't understand and what details do you need to understand my question? – user1764781 Nov 21 '12 at 14:53
@AkiSuihkonen, are you familiar with the Unity3D? – user1764781 Nov 21 '12 at 14:53
@LaurentCouvidou, what do you mean by "loop over your array of game objects" ? – user1764781 Nov 21 '12 at 14:55
show 2 more comments

closed as not a real question by Laurent Couvidou, Jonathan Hobbs, Josh Petrie, Trevor Powell, bummzack Dec 16 '12 at 13:10

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

2 Answers

In Unity3d it seems that Components contain their own modelview matrices, which are then modified with

object.Transform.Rotate(alpha,theta,phi); // and translated / moved around with
object.Transform.Translate(x,y,z).

Also Unity3D maintains hierarchical model of components:

in conceptual level (or pseudo Object Oriented Language) one makes e.g.

parent = new Component();
parent.add (array_of_children);    // dont know the actual syntax -
parent.Transform.Translate(x,y,z); // shifts all the children also
parent.array_of_children[7].Transform.Rotate(alpha,phi,theta); // rotate only this one

One should still consult a game / graphics programming tutorial with introduction to matrices.

share|improve this answer
actually the x,y,z and alpha, theta, phi are not fixed values, they can be x_2,y_2,z_2 and alpha_2, theta_2, phi_2 ... x_n,y_n,z_n and alpha_n, theta_n, phi_n – user1764781 Nov 21 '12 at 15:25
according to the x,y,z and alpha, theta, phi; x_2,y_2,z_2 and alpha_2, theta_2, phi_2 ... x_n,y_n,z_n and alpha_n, theta_n, phi_n I need to transform: public static List<string> GameObjects = new List<string>(); – user1764781 Nov 21 '12 at 15:27

If the issue is that value x is sent, and it is only valid for object y in the array, but at runtime you wouldn't be able to known which one is y. (it is JUST sending a float)

Then I think the issue is how the value is being sent. You really can't just sent a float. You would need to send a key pair or something. So when value x gets sent it has "name=object 2; value=5.7;" or something simmaler.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.