rvandoosselaer / Blocks

A block (voxel) engine for jMonkeyEngine
BSD 3-Clause "New" or "Revised" License
41 stars 14 forks source link

Issue in class file, which is not present in github code. #60

Closed fierceeo closed 3 years ago

fierceeo commented 3 years ago

I am using the latest version of the blocks lib (1.6.3) and for some reason when running my code my player falls though a chunk. I have PhysicsChunkPagerState physicsChunkPager = stateManager.getState(PhysicsChunkPagerState.class); physicsChunkPager.setLocation(new Vector3f(cam.getLocation())); put in the simpleUpdate method and this: stateManager.attachAll(new ChunkManagerState(chunkManager), new ChunkPagerState(chunkNode, chunkManager), new PhysicsChunkPagerState(getPhysicsSpace(), chunkManager)); and this: BlocksConfig.getInstance().setPhysicsGrid(new Vec3i(3, 1, 3)); in my simpleInitApp method.

I suspect that it has to do with this piece of code which for some reason is different then the code on github: image

If it helps, I here is my pom.xml file: ` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>org.example</groupId>
<artifactId>RamBlocks</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <jme3_g>org.jmonkeyengine</jme3_g>
    <jme3_v>3.3.2-stable</jme3_v>
</properties>

<repositories>
    <repository>
        <id>jcenterJMonkey</id>
        <url>https://dl.bintray.com/jmonkeyengine/org.jmonkeyengine</url>
    </repository>
    <repository>
        <id>jcenter</id>
        <url>https://jcenter.bintray.com/</url>
    </repository>
    <repository>
        <id>jcenterBlocks</id>
        <url>https://dl.bintray.com/remyvd/rvandoosselaer</url>
    </repository>
    <repository>
        <id>jcenterMathAndLemur</id>
        <url>https://dl.bintray.com/simsilica/Sim-tools/</url>
    </repository>
    <repository>
        <id>jcenterMinie</id>
        <url>https://dl.bintray.com/stephengold/com.github.stephengold/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>${jme3_g}</groupId>
        <artifactId>jme3-core</artifactId>
        <version>${jme3_v}</version>
    </dependency>
    <dependency>
        <groupId>${jme3_g}</groupId>
        <artifactId>jme3-desktop</artifactId>
        <version>${jme3_v}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>${jme3_g}</groupId>
        <artifactId>jme3-effects</artifactId>
        <version>${jme3_v}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>${jme3_g}</groupId>
        <artifactId>jme3-lwjgl</artifactId>
        <version>${jme3_v}</version>
    </dependency>
    <dependency>
        <groupId>${jme3_g}</groupId>
        <artifactId>jme3-testdata</artifactId>
        <version>${jme3_v}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.rvandoosselaer</groupId>
        <artifactId>blocks</artifactId>
        <version>1.6.3</version>
    </dependency>

    <dependency>
        <groupId>com.simsilica</groupId>
        <artifactId>sim-math</artifactId>
        <version>1.4.0</version>
    </dependency>

    <dependency>
        <groupId>com.github.stephengold</groupId>
        <artifactId>Minie</artifactId>
        <version>3.1.0-test2</version>
    </dependency>

    <dependency>
        <groupId>com.simsilica</groupId>
        <artifactId>lemur</artifactId>
        <version>1.14.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>3.0.6</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>com.jayfella</groupId>
        <artifactId>jme-fastnoise</artifactId>
        <version>1.0.2</version>
    </dependency>

    <dependency>
        <groupId>com.github.luben</groupId>
        <artifactId>zstd-jni</artifactId>
        <version>1.4.5-12</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.voidcitymc.blocks.Main</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

`

Thank you :)

fierceeo commented 3 years ago

Nm, I guess the issue about falling through the floor fixed itself. (The difference in code is still an issue) Just now I'm getting this issue when I talk around: image

fierceeo commented 3 years ago

odd it looks like this only happens when I jump up reasonably high

fierceeo commented 3 years ago

so I think I fixed the issue by changing line 36 in PhysicsChunkPager.java to this: if (chunk == null || chunk.getCollisionMesh() == null || physicsSpace == null || chunk.getCollisionMesh().getTriangleCount() <= 0) {

rvandoosselaer commented 3 years ago

Yes, this is a known issue. It's discussed here. The physics library can't handle empty mesh objects. The check you added is correct, I will fix this in the next release.

Concerning the 'falling through the floor' and jumping issues, I recommend you open a thread on the jMonkeyEngine forum. The things you describe are physics related (Minie library) issues and I'm not an expert on that matter.

rvandoosselaer commented 3 years ago

I created a hotfix for this bug and released a new version. If you bump your version to 1.6.4 the issues should be resolved.

fierceeo commented 3 years ago

Thank you :). So I tested it, and it seems to work fine now.