Main Menu
Menu

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.

Show posts Menu

Messages - kburden000

#1
Support / Re: Object Selector
March 23, 2012, 05:01:21 PM
Here's a routine that might be a little more pluggable.
private int selectAnyObjectAt( int mouseX, int mouseY){
SimpleVector ray=Interact2D.reproject2D3DWS(mCamera, mFrameBuffer, mouseX, mouseY).normalize();
Object[] res = mWorld.calcMinDistanceAndObject3D(mCamera.getPosition(), ray, 10000F);
if (res==null || res[1] == null || res[0] == (Object)Object3D.RAY_MISSES_BOX) {
Log.d("SELECTION", "You missed! x="+mouseX+" y="+mouseY);
selectedObject = null;
return -1;
}
Object3D obj = (Object3D)res[1];
Log.d("SELECTION", "x="+mouseX+" y="+mouseY+" id2="+obj.getID()+" name="+obj.getName());
selectedObject = obj;
return obj.getID();
}


This just gets you the selected object. It's up to you to figure how to move it about, based on the physics and layout of your world.
#2
Support / Re: physics test help
March 16, 2012, 09:21:13 AM
Danke
#3
Support / Re: physics test help
March 14, 2012, 10:59:23 AM
Egon

With your hints I got shadows working in jPCT with ShaowHelper as per post http://www.jpct.net/forum2/index.php/topic,2626.0.html
Now I too need shadows on jPCT-AE.

I see that you've "promised" to implement ShadowHelper in AE "someday". Maybe this week?  ;)

Anyway I'll go back to my shaders and try making a projective shader again.
I see the overall schema in jpct-ae/examples/HelloShader

You said in your replay above "just".
This indicates to me that this will be non-trivial so any additional hints or samples you could throw my way?

Also I'd like to develop the shader on my desktop using non-Android environment as this goes faster and then port/test in Android.
Do you have any warnings about developing with jPCT this way, above and beyond the usual package restrictions?

Thanks in advance
#4
Support / Re: FPS style camera rotation? HELP!
March 14, 2012, 06:46:34 AM
I can answer the camera pitch/yaw behavior portion of your question.
To wit why does the camera appear to ROLL when you try to turn it.
Remember that you have two different "coordinate systems" involved World and Camera
Also that cameras are usually pointed towards something ( usually as the result of a LookAt )
meaning that the UP Vectors in the two systems are NOT parallel.
What's an UP vector? Look it UP ;)

Imagine that you're in your world looking down at your object.
This means that your head may be bent at the neck. That is to say that your head is not straight up.
Now when you rotate your head about a single axis you're doing it in head ( i.e. camera ) coordinate system.
That means your turning it about your neck, not about your body.
Since your neck is bent it's like twisting your neck while looking down, the ground appears to swing back and forth.
What you want is to turn your whole body. not just twist your neck.

Here's some code I use.

private void turnLeft( float amt)
{
SimpleVector upOld = world.getCamera().getUpVector();
SimpleVector dirOld = world.getCamera().getDirection();
// Amt is in pi rads so its value would be something like 0.1f
// NOTE which world axis to rotate around
// depends on your coordinate system
// That is use whichever is the "UP" vector in your system
// So try different positions for the amt var say X or Z instead
// of Y as shown below in order to get the effect you want
SimpleVector rotation = new SimpleVector(0, amt, 0);
upOld = upOld.rotate(rotation);
dirOld = dirOld.rotate(rotation);
world.getCamera().setOrientation(dirOld, upOld);
}


It rotates the camera  along the "body" axis which unlike the neck axis is normal ( orthagonal/perpendicular) to the ground.
The camera ( i.e your head ) goes along for the ride and turns without changing your so called pitch/yaw.

Hope this explains things for you.
#5
As per your info in the previous post, I changed my code so that the groundPlane ( i.e. the grass ) no longer gets any shading.
This appears to have worked. I now have a cast shadow that blends with the receiver's texture rather than replacing it.

This is using solely the ShadowHelper/caster/receiver semantics from jPCT.

Here's a screenshot...


Thanks Egon.
 
#6
I can see that Shadows work in AdvancedDemo. Sorry they looked opaque black until I looked closer on a better monitor.
I just hopefully figure it by dissecting the Demo.
Thanks for your time
#7
I've got cast shadows with a ShadowHelper and a Shader working, but the shadow is always a solid non-transparent color.

Here's a screen shot. The facial image is the caster and the grass below is the receiver.


Is it possible to make the cast shadow a partially  transparent color?
I would like to make the blue shadow coming behind the portrait appear to just "darken" the grass behind and leave the tiling intact.

If yes, a hint about how to do it would be appreciated.

Thanks