How would one make the jumping faster? it seems like a low gravity example… what would I have to do to increase the speed with which the character jumps/falls?
it would be cool if that would also be a variable where the other variables are declared
How would one make the jumping faster? it seems like a low gravity example… what would I have to do to increase the speed with which the character jumps/falls?
it would be cool if that would also be a variable where the other variables are declared
I made my own level with 3ds max and exported it with the 3ds max egg exporter with the material given in the test sample zip. But there’s a problem… my camera keeps falling through the environment… I’m using single sided polygons and everything is in editable meshes (not polygons). Is there something I should tweak to make this work?
there is a comment in the function for loading the level:
# must have
#<Group> *something* {
# <Collide> { Polyset keep descend } in the egg file
add it to your egg file and it should work
I exported a simple box object from 3ds max. it’s a editable mesh. I added the part but it still doesn’t work…
here’s the insides of plane.egg:
<CoordinateSystem> { Z-Up }
<Comment> {
"MaxEggPlugin nul.max -a model -bface 'C:\Panda3D-1.5.2\samples\simple-fps\plane.egg'"
}
<Group> {
<Dart> { 1 }
<Group> Box01 {
<Collide> { Polyset keep descend }
<VertexPool> Box01.verts {
<Vertex> 0 {
-100 -100 0
<UV> { 1 0 }
<Normal> { 0 0 -1 }
}
<Vertex> 1 {
-100 100 0
<UV> { 1 1 }
<Normal> { 0 0 -1 }
}
<Vertex> 2 {
100 100 0
<UV> { 0 1 }
<Normal> { 0 0 -1 }
}
<Vertex> 3 {
100 -100 0
<UV> { 0 0 }
<Normal> { 0 0 -1 }
}
<Vertex> 4 {
-100 -100 30
<UV> { 0 0 }
<Normal> { 0 0 1 }
}
<Vertex> 5 {
100 -100 30
<UV> { 1 0 }
<Normal> { 0 0 1 }
}
<Vertex> 6 {
100 100 30
<UV> { 1 1 }
<Normal> { 0 0 1 }
}
<Vertex> 7 {
-100 100 30
<UV> { 0 1 }
<Normal> { 0 0 1 }
}
<Vertex> 8 {
-100 -100 0
<UV> { 0 0 }
<Normal> { 0 -1 0 }
}
<Vertex> 9 {
100 -100 0
<UV> { 1 0 }
<Normal> { 0 -1 0 }
}
<Vertex> 10 {
100 -100 30
<UV> { 1 1 }
<Normal> { 0 -1 0 }
}
<Vertex> 11 {
-100 -100 30
<UV> { 0 1 }
<Normal> { 0 -1 0 }
}
<Vertex> 12 {
100 -100 0
<UV> { 0 0 }
<Normal> { 1 0 0 }
}
<Vertex> 13 {
100 100 0
<UV> { 1 0 }
<Normal> { 1 0 0 }
}
<Vertex> 14 {
100 100 30
<UV> { 1 1 }
<Normal> { 1 0 0 }
}
<Vertex> 15 {
100 -100 30
<UV> { 0 1 }
<Normal> { 1 0 0 }
}
<Vertex> 16 {
100 100 0
<UV> { 0 0 }
<Normal> { 0 1 0 }
}
<Vertex> 17 {
-100 100 0
<UV> { 1 0 }
<Normal> { 0 1 0 }
}
<Vertex> 18 {
-100 100 30
<UV> { 1 1 }
<Normal> { 0 1 0 }
}
<Vertex> 19 {
100 100 30
<UV> { 0 1 }
<Normal> { 0 1 0 }
}
<Vertex> 20 {
-100 100 0
<UV> { 0 0 }
<Normal> { -1 0 0 }
}
<Vertex> 21 {
-100 -100 0
<UV> { 1 0 }
<Normal> { -1 0 0 }
}
<Vertex> 22 {
-100 -100 30
<UV> { 1 1 }
<Normal> { -1 0 0 }
}
<Vertex> 23 {
-100 100 30
<UV> { 0 1 }
<Normal> { -1 0 0 }
}
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 0 1 2 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 2 3 0 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 4 5 6 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 6 7 4 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 8 9 10 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 10 11 8 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 12 13 14 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 14 15 12 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 16 17 18 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 18 19 16 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 20 21 22 <Ref> { Box01.verts } }
}
<Polygon> {
<RGBA> { 0.588235 0.588235 0.588235 1 }
<BFace> { 1 }
<VertexRef> { 22 23 20 <Ref> { Box01.verts } }
}
}
}
Either export it as static mesh, or remove the tag in the egg.
I removed the Dart tag from the .egg file and nothing happened… how do I export a static mesh from 3ds max? it only has editable mesh and editable poly
There used to be “pose” option, I don’t know about the new exporter.
I don’t know if there is a ‘new’ exporter, since the one for max is pretty old…
I changed the type to pose and exported with double-sided polygons and somehow if I export a box (editable mesh) made with the most basic tools the program doesn’t find the collision.
here’s my code:
<CoordinateSystem> { Z-Up }
<Texture> Tex1 {
6061.jpg
<Scalar> format { rgb }
<Scalar> wrapu { repeat }
<Scalar> wrapv { repeat }
<Scalar> minfilter { linear_mipmap_linear }
<Scalar> magfilter { linear }
}
<Group> Plane01 {
<Collide> { Polyset keep descend }
<Transform> {
<Matrix4> {
-1 -1.50996e-007 0 0
1.50996e-007 -1 0 0
0 0 1 0
-5 -5 0 1
}
}
<VertexPool> Plane01.verts {
<Vertex> 0 {
10.25 -20 1.35307
<UV> { 0 1 }
<Normal> { 0 0 1 }
}
<Vertex> 1 {
10.25 10 1.35307
<UV> { 0 0 }
<Normal> { 0 0 1 }
}
<Vertex> 2 {
-19.75 -20 1.35307
<UV> { 1 1 }
<Normal> { 0 0 1 }
}
<Vertex> 3 {
-19.75 10 1.35307
<UV> { 1 0 }
<Normal> { 0 0 1 }
}
<Vertex> 4 {
10 -20 0
<UV> { 0 1 }
<Normal> { 0.983361 1.48483e-007 -0.181662 }
}
<Vertex> 5 {
10 10 0
<UV> { 0 0 }
<Normal> { 0.983361 1.48483e-007 -0.181662 }
}
<Vertex> 6 {
10.25 10 1.35307
<UV> { 0 0 }
<Normal> { 0.983361 1.48483e-007 -0.181662 }
}
<Vertex> 7 {
10.25 -20 1.35307
<UV> { 0 1 }
<Normal> { 0.983361 1.48483e-007 -0.181662 }
}
<Vertex> 8 {
-20 -20 0
<UV> { 1 1 }
<Normal> { 1.50996e-007 -1 0 }
}
<Vertex> 9 {
10 -20 0
<UV> { 0 1 }
<Normal> { 1.50996e-007 -1 0 }
}
<Vertex> 10 {
10.25 -20 1.35307
<UV> { 0 1 }
<Normal> { 1.50996e-007 -1 0 }
}
<Vertex> 11 {
-19.75 -20 1.35307
<UV> { 1 1 }
<Normal> { 1.19207e-007 -1 7.10698e-007 }
}
<Vertex> 12 {
-20 10 0
<UV> { 1 0 }
<Normal> { -0.983361 -1.48483e-007 0.181662 }
}
<Vertex> 13 {
-20 -20 0
<UV> { 1 1 }
<Normal> { -0.983361 -1.48483e-007 0.181662 }
}
<Vertex> 14 {
-19.75 -20 1.35307
<UV> { 1 1 }
<Normal> { -0.983361 -1.48483e-007 0.181662 }
}
<Vertex> 15 {
-19.75 10 1.35307
<UV> { 1 0 }
<Normal> { -0.983361 -1.48483e-007 0.181662 }
}
<Vertex> 16 {
10 10 0
<UV> { 0 0 }
<Normal> { -1.50996e-007 1 -7.04825e-007 }
}
<Vertex> 17 {
-20 10 0
<UV> { 1 0 }
<Normal> { -1.50996e-007 1 -7.04825e-007 }
}
<Vertex> 18 {
-19.75 10 1.35307
<UV> { 1 0 }
<Normal> { -1.50996e-007 1 -7.04825e-007 }
}
<Vertex> 19 {
10.25 10 1.35307
<UV> { 0 0 }
<Normal> { -1.19207e-007 1 -5.87258e-009 }
}
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 0 1 2 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 3 2 1 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 4 5 6 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 6 7 4 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 8 9 10 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 10 11 8 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 12 13 14 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 14 15 12 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 16 17 18 <Ref> { Plane01.verts } }
}
<Polygon> {
<RGBA> { 1 1 1 1 }
<TRef> { Tex1 }
<BFace> { 1 }
<VertexRef> { 18 19 16 <Ref> { Plane01.verts } }
}
}
Try to name the with the name.
on a side note i recommend running all collision meshes it through my collisions optimizer:
discourse.panda3d.org/viewtopic.php?p=23267#23267
I have seen speed ups of x10 times and more!
I did this in the .egg file:
<Group> Plane01 {
<Collide> Plane01 { Polyset keep descend }
still, no results
I found a note by ynjh_jo on an other topic that had to do with falling through a geometry:
How would I go and implement this?
You would need to fix is_right function in collisionPolygon.I and compile Panda to pick that change.
But first you can confirm if it’s what’s happening. Shift the avatar position a little. If that fix it, it’s indeed the slip-through bug. If that can’t fix it, it must be something else. Try to open the egg with pview and press shift-c to see the collision polygon. Is it exactly fit the visible geometry ?
I do notice that your little box appears to be missing a floor polygon, though it does have a ceiling polygon.
Also, you have to make sure that your normals are facing the right direction. Enabling double-sided rendering affects the look of the polygons only; it does not affect collisions. If your normals are facing the wrong way, you will pass through the polygons. Better if you don’t enable double-sided rendering, since that will make it easier to visually see if you’ve got the normals wrong.
David
Hello,
Took me a while to realise i kept falling through floor as it was set in code in jump function to only collide with a model called Cube, and as i wanted to have more than one model i RIPPED OFF YOUR CODE and have started a Physics based version and posted in new topic:
https://discourse.panda3d.org/viewtopic.php?t=4921
Hope people can help me get the TODO list done and have a reusable class for all to enjoy.
I have setup a git repo for this in case any one is interested
github.com/treeform/simple-fps
MY TODO list of this:
thanks. i’ll surely look into it
Hi!
This is a nice little demo. A few things bug me though: Traker posted a snippet to hide the mouse cursor, which is a good idea. But the mouse look is very “jerky” on OS X. (Haven’t tried this on another OS.) To fix that, you can also set the mouse mode to relative:
props = WindowProperties()
props.setCursorHidden(True)
props.setMouseMode(WindowProperties.MRelative)
base.disableMouse()
base.win.requestProperties(props)
Ah, much better.
The mouse was jerky on Linux too, but adding these line fixes it for me too, indeed. Though for the Linux users, relative mouse mode is not supported until 1.7.0.
Windows is probably unaffected as it keeps subpixel data of the mouse position when you move it programatically.
Keep in mind, I have no idea what the relative mouse mode is, what it does, or why it works. This is a piece of code I found elsewhere on the forums, and the original suggestion was given by drwr.
I wasn’t able to find any other documentation. ;(