First person room. (Surface “Y” Coordinates)

Software: Away3D 4.x

Avatar
ibsenleo, Newbie
Posted: 16 November 2014 04:13 PM   Total Posts: 8

Hello, im trying to build a first person walkable room. This room has 2 plants and i would like to know if there is a way to find the height of a mesh in a particular point (x,z). I know this is possible with the Elevation class, but i had to build the mesh in 3D studio. Maybe there is a way to get it without get involved with Physics (i’m not used yet to the Phys system).

Im wondering if some of you has some simple idea how to get this.

I found the infiniteturtles example of the frustrum hotel room, but is not a simple one since he uses a collision map and the check collision is not clear for me.

Thanks

Ibsen.

   

Avatar
Fabrice Closier, Administrator
Posted: 16 November 2014 08:57 PM   Total Posts: 1265   [ # 1 ]

myplant.getHeight() ?

   

Avatar
ibsenleo, Newbie
Posted: 16 November 2014 09:24 PM   Total Posts: 8   [ # 2 ]

Hi Fabrice,

Thanks for your reply.
Please, correct me if im wrong, but getHeight() is a method of Elevation class isn’t it?. If this is right i can’t use it because what i want to do is to create a “Duplex” flat with stairs and another plain surface upstairs.

I decide to use de AwayPhysics motor, and it works so nice! but have a problem. When i “fall” from a plane to another plane, my “character” goes through the second plane ignoring it and falling constantly.

My solution by the moment is warp the character to some point again.

code:

//Base
var landMaterial:ColorMaterial = new ColorMaterial(0x232323);
landMaterial.lightPicker _lightPicker;
landMaterial.shadowMethod = new DitheredShadowMapMethod(_light);
landMaterial.shadowMethod.epsilon 0.13;
   
var 
landGeom:CubeGeometry = new CubeGeometry(2000,10,2000);
_land = new Mesh(landGeom,landMaterial);
_scene.addChild(_land);
   
   
_landCollision= new AWPCollisionObject(new AWPBoxShape(2000,10,2000),_land);
_landCollision.position= new Vector3D(0,0,0);
_world.addCollisionObject(_landCollision);
   
//1stFloor
var platform:Mesh = new Mesh(new CubeGeometry(500,10,500), landMaterial)
platform.position = new Vector3D(0,500,0);   
_scene.addChild(platform);
   
var 
platformCollision:AWPCollisionObject = new AWPCollisionObject(new AWPBoxShape(500,10,500),platform);
platformCollision.position platform.position
_world
.addCollisionObject(platformCollision); 

And my character:

[
//POW Mesh
_pow = new Mesh(new CubeGeometry(10,10,10), new ColorMaterial(0xff00ff));
_pow.castsShadows false;
   
_view.scene.addChild(_pow);
_fpc = new FirstPersonController(_pow)
    
var 
ghost:AWPGhostObject = new AWPGhostObject(new AWPBoxShape(10,10,10),_pow);
_powBody = new AWPKinematicCharacterController(ghost,2);
_powBody.warp( new Vector3D(0,1000,0));
   
_world.addCharacter(_powBody); 

If someone has some idea i will thanks a lot.


No idea is stupid. Don’t hesitate to write something if you think some possible solution smile)
Thanks

 

   

Avatar
Fabrice Closier, Administrator
Posted: 17 November 2014 08:08 PM   Total Posts: 1265   [ # 3 ]

No I ment, you have getWidth, getHeight, getDepth on object3D. You can also if axis aligned use the min and max values for the bounding box to calculate it.

As about going thru, make sure the collider is thick enough or increase fps simulation.

   

Avatar
ibsenleo, Newbie
Posted: 18 November 2014 05:58 PM   Total Posts: 8   [ # 4 ]

Hello again!

i dismissed the option without physics, so i try to fix it with your suggestion in the phys environment and Works!!

As about going thru, make sure the collider is thick enough or increase fps simulation.

However, the problem still remains despites i dont fall anymore.

Should i open a new post in the AwayPhysics forum? or some admin can move the post (i dont want to fill the forum with duplicated posts)

Ok, meanwhile i post here my problem waiting for instructions about the post.

The problem is when i fall from the platform, it doesn’t fall with gravity like when i jump, but is like a hard movement full gravity!

i will leave here a link with my test movie and the source (is not so tidy but i think is clear, i hope raspberry Sorry, is testing purpouse)

Thanks for your help. The learning curve for phys in 3D is hard, and harder when you are beginning in 3D world. Thanks for the patience.

http://ensamblemusicart.com/examples/index.html - Example
http://ensamblemusicart.com/examples/srcview/index.html - Source

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X