Giter Site home page Giter Site logo

jvpichowski / zayes-bullet Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 347 KB

Contains a simple example how you can combine native bullet and zay es

License: BSD 3-Clause "New" or "Revised" License

Java 100.00%
jmonkeyengine3 bullet-physics jme3 bullet zayes

zayes-bullet's Introduction

ZayES-Bullet

ZayES and Bullet are two key elements of jME3. This library aims to be a flexible and easy to use adapter between them. Every entity could be integrated into the physics calculations by only combining physics components.

Getting started

The easiest way to get started is to clone this repository and have a look at the examples in the test folder. You'll notice the most important aspects.

Adding ZayEs-Bullet to your project

ZayES-Bullet is released on bintray. Just add the dependency definition to your build file or download directly the needed jars. There are javadoc and sources available. (Direct link to Bintray) Don't forget to add the needed bintray repository to your repositories:

maven { url "https://dl.bintray.com/jvpichowski/jME3-Tools/" }

Or you could use 'jitpack.io' to fetch the latest changes (They may be breaking changes). Just use this example 'build.gradle' file:

group 'com.jvpichowski'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    jcenter()
    maven { url 'https://jitpack.io' }
}

ext.jmeVersion = '3.1.0-stable'

dependencies {

    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"

    compile "org.jmonkeyengine:jme3-bullet-native:$jmeVersion"
    compile "org.jmonkeyengine:jme3-bullet:$jmeVersion"

    compile 'com.simsilica:sio2:1.0.3'
    compile 'com.simsilica:zay-es:1.2.1'

    compile 'com.github.jvpichowski:ZayES-Bullet:master-SNAPSHOT'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

Architecture

ZayES-Bullet consists of two parts. On the one hand there are the components you need to describe your entity (e.g. mass, shape, ...). Have a look in the components package to discover all of them. On the other hand there is the BulletSystem which pulls those information, adds them to the physics simulation and propagates the new state back to the entity in form of components. Then you could watch for them and change your game view. The BulletSystem is the complex part and could be extended in various ways but usually you only have to create it and call update() from time to time to update its state. Don't forget to destroy it if you don't need it anymore. I have added an ESBulletState Because this library is mostly used by jME3 developers. This states handles the creation, destruction and update of the BulletSystem for you. You simple have to attach it to your StateManager. In the constructor you can specify different threading modes. See the javadoc for more explanation on them.

Thread safety

ZayES is by default threadsafe. As a consequence you don't have to worry to much about thread safety if you only read and add components. But there could be some pitfalls with the BulletSystem for advanced users because you can obtain direct access to the Bullet PhysicsSpace (e.g. to register listeners). You have to be aware that the listeners are called from the physics thread and not from the render thread. As a consequence you have to enqueue all events.

Versioning

This library is still in an alpha state. The key features should work but there has to be more testing. Be aware that the api might change. At the moment I'm very happy with the core api and it probably won't change anymore. But be warned that there could still be breaking changes in later releases.

Road map

The next step will be a good character control. Then I will add more advanced components like a force field. And I will improve my own debug view.

License

ZayES-Bullet is released under the BSD 3-Clause License. If you like it I would be proud if you show me your work and give credit to me.

Getting in touch

I have a thread in the jME3 forum where I will discuss several aspects. There you have the chance to ask questions and state your requirements.

zayes-bullet's People

Contributors

jvpichowski avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zayes-bullet's Issues

Suggestion: Renaming Class "Character"

Hey,
This suggestion isn't important right now, but something to consider before releasing Version 1.0:

Since java.lang is always imported in each class, you can't directly reference the Character Component, because it matches the boxed Version of char. That's why you have:

edS.getEntityData().setComponents(playerEntity,
                new com.jvpichowski.jme3.es.bullet.character.Character(50, 0.35f, 2f),

If you would change that to PhysicsCharacter or something, this would have been solved (Actually you might come up with different Components anyway.).

Another possibility would be to append Component to the class name of any Component, but I guess this is bad style :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.