Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dutch_delight

Pages: 1 2 [3] 4
31
Support / Re: multiple worlds and clipping planes
« on: October 17, 2011, 12:12:06 am »
Sorry for the late reply. doing stupid overtime at work so had no time to work on my game.

And sorry for the poor screenshot but here it is:
http://www.richterdesigns.co.uk/stuff/clipping.jpg

The ground surface has a large clipping plane and the objects are in a different world with a much lower clipping plane.
The building on the left is nearby but when i move backwards, it looks like it's sinking into the surface object. (the right image)
If i put all objects into the surface world, it's all fine and visa versa if i put everything into the objects world.


32
Support / multiple worlds and clipping planes
« on: September 24, 2011, 09:21:28 pm »
Hi all

Just a quick question about multiple worlds and clipping planes.

I've got 2 worlds, one is my terrain and skydome and has a large clipping plane (200000) and I have a second world for my scenery objects with a clipping plane of 5000. The terrain object is about 4000 polygons and is my entire playing world.

My objects sit on top of the scenery but when my objects get in range, they seem to slowly emerge from beneath the terrain and visa versa if I move away from them, they look like they sink beneath the terrain.
I am not sure what is happening, if i have all my terrain and objects in the same world, they are fine but putting them in the second world it looks like they are moving in the Y axis.

I know, I know, I probably shouldnt use a clipping plane that large but I need the world to be as big as possible. And I dont want to draw all my objects in the same world because they would all be drawn even if they're miles away.

If there is no solution to this, is there perhaps another way to cull objects when they are a certain distance from the camera without having to loop through all of them?


Thanks for any suggestion and help
Rich

33
Projects / Re: 3D StreetLuge
« on: July 14, 2011, 02:54:53 pm »
I had a similar proplem with my game when i (system) updated my phone recently. (nexus S) It worked absolutely fine before but then after the update it gave a similar effect to what Egon describes.

If i remember correctly it turned out that my pitch controls needed to be inside an if check like so:

Code: [Select]
public void onSensorChanged(SensorEvent event) {
final int type = event.sensor.getType();

if (type == Sensor.TYPE_ORIENTATION) {
orientationData = event.values.clone();
azimuth = event.values[0];
pitch = event.values[1];
roll = event.values[2];
}
}
hope that helps

34
Support / getting Object3D properties from a class/array
« on: June 18, 2011, 04:40:44 pm »
Hi all,

I'm stuck at something that probably isnt for this forum but not sure how to google this problem.
Bear in mind I'm still a Java amateur so that doesnt help.

I've got an Object3D array like this that gets pre-loaded on startup so it's got several different objects/classes in there.

Code: [Select]
private List<Object3D> WorldEnemies = new ArrayList<Object3D>();

Then I loop through my list:

Code: [Select]
int tp = 0;
int end = WorldEnemies.size();

for (int i = 0; i < end; i++) {

Object3D Object = WorldEnemies.get(tp);
int WayPoint =  Object.GetWayPoint ();
tp++;
}

But the problem is getting the WayPoint from the class. Eclipse wants to Cast the object to a certain type like so:
Code: [Select]
int WayPoint =  ((msam) object).GetWayPoint();But that doesnt really work. It's not really giving an error message, the game just slows to a crawl.
(msam is an object that has Getwaypoint defined but there will be different objects with the same function later)
Getwaypoint returns an int from the class.

Is there a way to make the WayPoint a part of the Object3D so I always have access to it no matter the object type?
Or could I store the object type in a separate array and do an if/then?



oh i'm developing for android btw but this is more a java question i think.

Thanks for any advice

35
Support / Re: OutOfMemory error occurs when restart game
« on: May 27, 2011, 02:26:37 pm »
I do this in my program but I dont think it's the recommended method:

Code: [Select]
int pid = android.os.Process.myPid();
android.os.Process.killProcess(pid);


Certainly gets rid of everything though.

36
Support / Re: child transformations
« on: May 27, 2011, 10:52:19 am »
Well, I had nearly given up but I fixed it last night. Here's the code if anyone needs it. I also forgot about a pivot reset in my Missile_move function which caused another offset. (or could have been the problem al along)

Thanks Mr Olsen. ;)

Code: [Select]
Matrix wt = this_missile.getWorldTransformation();
Matrix m = new Matrix(wt);
m.setRow(3,0,0,0,1);

this_missile.removeParent(player);
this_missile.setRotationMatrix(m);
this_missile.setTranslationMatrix(wt);

//missiles are too high in world space for some reason, this lowers them
SimpleVector move_down = new SimpleVector(0,7,0);
this_missile.translate(move_down);

37
Support / Re: child transformations
« on: April 12, 2011, 08:56:01 pm »
This image shows the left and right missile firing. too far to the left and right. Chopper is not rotated.
http://www.richterdesigns.co.uk/stuff/no_rotation_translation.jpg

Here the chopper is rotated to the left about 90 degrees. The missiles fire from the right of the screen.
http://www.richterdesigns.co.uk/stuff/rotated_90_translation.jpg

And here I am rotated 180 degrees. missiles still from the left and slightly behind the chopper.
http://www.richterdesigns.co.uk/stuff/rotated_180_translation.jpg

THis happens when I dont translate the missiles after your bit of code:
http://www.richterdesigns.co.uk/stuff/no_translation.jpg

Almost like they are rotated around an invisible point


Code: [Select]
Matrix wt=this_missile.getWorldTransformation();
 
SimpleVector missile_translate = wt.getTranslation();
Matrix m = new Matrix(wt);
m.setRow(3,0,0,0,1);
         
this_missile.removeParent(player);

this_missile.translate(missile_translate);
SimpleVector test = new SimpleVector (0,300,-150);
this_missile.translate(test);


this_missile.setRotationMatrix(m);


38
Support / Re: child transformations
« on: April 11, 2011, 09:28:44 pm »
Excellent, thank you very much.

The missiles now move along the correct axis but seem to be offset from the main body for some reason. I think it may have something to do with my initial setup.
This is what I have to do on the initial setup to get them in the correct position (mounted underneath the chopper wings)

Code: [Select]
SimpleVector[] missile_offset = new SimpleVector[missile_count];
missile_offset[0] = new SimpleVector(-390, 572, 130);
missile_offset[1] = new SimpleVector(-480, 572, 130);
missile_offset[2] = new SimpleVector(-407, 572, 130);
missile_offset[3] = new SimpleVector(-467, 572, 130);
missile_offset[4] = new SimpleVector(-390, 582, 130);
missile_offset[5] = new SimpleVector(-480, 582, 130);
missile_offset[6] = new SimpleVector(-407, 582, 130);
missile_offset[7] = new SimpleVector(-467, 582, 130);

texMan.addTexture("tmissile", new Texture(res.openRawResource(R.raw.tmissile)));
missile_template = (Loader.loadSerializedObject(res.openRawResource(R.raw.mmissile)));
missile_template.setTexture("tmissile");
missile_template.compile();
missile_template.rotateX((float) -Math.PI / 2f);
missile_template.rotateMesh();
missile_template.clearRotation();

for (int i = 0; i < 8; i++) {

missile_array[i] = missile_template.cloneObject();
world.addObject(missile_array[i]);
missile_array[i].setScale(0.1f);
missile_array[i].addParent(player);
missile_array[i].setOrigin(missile_offset[i]);
missile_status[i] = 1;
}

39
Support / Re: child transformations
« on: April 07, 2011, 12:44:48 am »
Sorry to keep buggin you but I cant get my missiles to rotate properly. With this code, the missiles are translated roughly to the right position but the rotation doesnt work. Any chance you could point me in the right direction? Also, is there a nicer way to do the rotation code?

Code: [Select]
SimpleVector missile_translate = this_missile.getWorldTransformation().getTranslation();
Matrix m = new Matrix(playerTilt.getRotationMatrix());
float[] dm = m.getDump();

this_missile.removeParent(player);

this_missile.translate(missile_translate);
this_missile.rotateX(dm[12]);
this_missile.rotateY(dm[13]);
this_missile.rotateZ(dm[14]);


Thanks for any help.





40
Support / Re: child transformations
« on: March 29, 2011, 10:56:42 am »
Thanks, I'll try doing that tonight.
(now, where did i put my "Maths for dummies" book?)   ;)

41
Support / child transformations
« on: March 26, 2011, 07:41:54 pm »
Just wandering if anyone could help me (again)

I've got player helicopter in a hierarchy in this order:

playerlift  - (dummy) controls the forward speed and Y rotation (steering)
playertilt  - (dummy) tilts the chopper forwards and backwards to indicate movement
player - (Object3D) rotates in the Z direction for banking the chopper
missiles - (Object3D) inherits all rotations untill fired.

The helicopter height never changes.

when I set up my models, the missiles are parented to the player so everything works fine. The problem happens when I fire a missile. I un-parent the missile so that it can continue it's current direction. But when doing so it resets to it's original position and rotation.

Now, my maths being what it is I'm a little bit stuck here (again).
There are some threads about this but could anyone give me a pointer on how to do this?

I've got this from the forum:
direction.matMul(parent.getWorldTransformation().invert3x3());

But how would I use this in a hierarchy like mine? Should I get the transform of each parent and apply that to my missiles?


42
Support / Re: model offsets problems
« on: March 25, 2011, 10:32:05 am »
very strange.

I think the problem happens when I rotate my objects. After I load my Ser files, I rotate them 90 degrees and then scale them to the same amount you do. I suppose it rotates each object around it's transform center which is different for each object. Maybe?
But when I load the 3ds like you do, I have no problems (cant believe I didnt test this myself.)

For now, I rotate the objects in max and load them as 3ds files which seems to be perfect. Tonight I'll try to see what happens if I link all the lods to a dummy and rotate just the dummy.

Thanks for testing and for taking the time to look at my problem.


43
Support / Re: model offsets problems
« on: March 22, 2011, 11:54:53 pm »
Sorry, I've been writing plugins for 3dsmax for too long so probably aproaching this from the wrong angle.
I didnt want to burden anyone but if someone could have a look at my models I would really appreciate it.
I've included 3ds and ser files.
http://www.richterdesigns.co.uk/stuff/terrain_slices.zip

44
Support / Re: model offsets problems
« on: March 22, 2011, 10:46:23 am »
Well, I'm now calculating the offset and sutracting them from the models which put them roughly in the same position. Still not accurate unfortunately.

I take it that getTransformedCenter() will not be the same for each object?
Is there a way of setting the pivot point like in max? Pivot point being the point around which the mesh is build.

If i could set a pivot point to a certain vertex, I could do that for all and move the objects to that point.


I hope I can because I've started work on my own mesh exporter but I havent got enough Java experience to make that work efficiently.


45
Support / Re: model offsets problems
« on: March 20, 2011, 04:31:23 pm »
I've already tried all the suggestions in there.

Perhaps I'll try to subtract the distances and apply them as transformations might move them to the right positions?


Pages: 1 2 [3] 4