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 - Windmiller

Pages: 1 [2]
16
Yes! Thank you Egon, the result is just fabulous  :)

I made it with the following code..

Code: [Select]
SimpleVector touchPoint = Interact2D.reproject2D3DWS(cam, fB, (int) x, (int) y);
float distance = theSphere.calcMinDistance(camPos, touchPoint, 1000);

SimpleVector pickedCoordinate = theSphere.mPickedCoordinate;

pickedCoordinate.matMul(theSpehere.getWorldTransformation().invert());

Object3D cube = Primitives.getCube(5f);
theSphere.addChild(cube);

cube.translate(pickedCoordinate);
world.addObject(cube);

You saved my game, really big thanks to you.

Regards, M

17
Hi

I have some difficulties setting a child of a parent object when parent is rotated.

I have a custom sphere object class name TheSphere that extends Object3D and implements CollisionListener
with the following overridden functions..

Code: [Select]
public void collision(CollisionEvent collisionEvent) {

        this.mPickedCoordinate = collisionEvent.getFirstContact();
    }

    @Override
    public boolean requiresPolygonIDs() {
        return true;
    }

And from the Graphics thread I'm taking the value stored in this.mPickedCoordinate to add a Primitives.getCube() at that coordinate with the following code.

Code: [Select]
SimpleVector touchPoint = Interact2D.reproject2D3DWS(cam, fB, (int) x, (int) y);
float distance = theSphere.calcMinDistance(camPos, touchPoint, 1000);

SimpleVector pickedCoordinate = theSphere.mPickedCoordinate;
pickedCoordinate.sub(SimpleVector.create(theSphere.getPosX(), theSphere.getPosY(), theSphere.getPosZ()));

Object3D cube = Primitives.getCube(5f);
theSphere.addChild(cube);
cube.translate(pickedCoordinate);
world.addObject(cube);

So when I'm touching the sphere it places a cube at the right point, but if I rotate the sphere and touch it again then a new cube will be added to the rotated side and not where I've put my finger.

How can I add a cube to the point where I've touched the sphere even when the sphere has been rotated up or down side to side doesn't matter as long as it places the cube where my finger where.

getFirstContact will always return the (not) rotated point :(

I'm lost here, please help me.

Regards, M

18
Aaah thank you for your replies and explanations, I see and understand.
It was just weird that it was working without the .setEnvmapped(Object3D.ENVMAP_ENABLED);

19
Hello

Some objects (Randomly) are turning into black after screen orientation change or powering up from standby,
they do not come back from that black state.
Completely black, no light reflections or anything. It doesn't matter how many objects I'm loading or whether they have textures or not even if I'm just using Primitives getCube. This happens on both my devises that I'm testing on (a Nexus 7 and a Samsung Galaxy 8)

I don't understand why this happens, my project is the HelloWorld that I've changed a bit but not much.
Anyone who can recognize the behavior and give me a light pointing in the right direction?

Edit: seems to be something with that I'm using..

Code: [Select]
shareCompiledData(mObj);
shareTextureData(mObj);

Edit 2: Actually it seems to be in combination with this line..

Code: [Select]
.setEnvmapped(Object3D.ENVMAP_ENABLED);

If I remove the  environment mapping for the object the problem goes away!? Why??

Regards, M

20
Support / Re: Rotate object according to forward and downward vectors
« on: April 18, 2020, 12:02:59 am »
Thank you! I didn't see that function, thanks a million  :)

21
Support / Rotate object according to forward and downward vectors
« on: April 17, 2020, 12:01:52 am »
Hello

I'm trying to rotate a cube in object's space (local) based on a forward and a downward vector.
I want one of the object's side faces to point in a forward vector, while the cube's down face is pointing in the downward vector's direction.

How can this be done with Jpct-AE? I now how to do it in Monogame, but I can't make it happen with Jpct

I can make one of the directions with the following code, here the forward as an example..

Code: [Select]
cube.setRotationMatrix(forwardVector.getRotationMatrix());
But How do I combine this with the downward vector??


Regads, M


Pages: 1 [2]