Commit f18bea83 authored by Matteo De Carlo's avatar Matteo De Carlo Committed by davvore33

squash

parent 320f49f2
[![Godot Engine logo](/logo.png)](https://godotengine.org)
# Marte engine
## Godot Engine
A fork from [godot engine](https://whatever.com) customized for our
marte project.
Homepage: https://godotengine.org
You will see.
#### 2D and 3D cross-platform game engine
Godot Engine is a feature-packed, cross-platform game engine to create 2D and
3D games from a unified interface. It provides a comprehensive set of common
tools, so that users can focus on making games without having to reinvent the
wheel. Games can be exported in one click to a number of platforms, including
the major desktop platforms (Linux, Mac OSX, Windows) as well as mobile
(Android, iOS) and web-based (HTML5) platforms.
#### Free, open source and community-driven
Godot is completely free and open source under the very permissive MIT license.
No strings attached, no royalties, nothing. The users' games are theirs, down
to the last line of engine code. Godot's development is fully independent and
community-driven, empowering users to help shape their engine to match their
expectations. It is supported by the Software Freedom Conservancy
not-for-profit.
Before being open sourced in February 2014, Godot had been developed by Juan
Linietsky and Ariel Manzur (both still maintaining the project) for several
years as an in-house engine, used to publish several work-for-hire titles.
![Screenshot of a 3D scene in Godot Engine](https://download.tuxfamily.org/godotengine/media/screenshots/editor_3d_fracteed.jpg)
### Getting the engine
#### Binary downloads
Official binaries for the Godot editor and the export templates can be found
[on the homepage](https://godotengine.org/download).
#### Compiling from source
[See the official docs](https://docs.godotengine.org/en/latest/development/compiling/)
for compilation instructions for every supported platform.
### Community and contributing
Godot is not only an engine but an ever-growing community of users and engine
developers. The main community channels are listed [on the homepage](https://godotengine.org/community).
To get in touch with the developers, the best way is to join the
[#godotengine IRC channel](https://webchat.freenode.net/?channels=godotengine)
on Freenode.
To get started contributing to the project, see the [contributing guide](CONTRIBUTING.md).
### Documentation and demos
The official documentation is hosted on [ReadTheDocs](https://docs.godotengine.org).
It is maintained by the Godot community in its own [GitHub repository](https://github.com/godotengine/godot-docs).
The [class reference](https://docs.godotengine.org/en/latest/classes/)
is also accessible from within the engine.
The official demos are maintained in their own [GitHub repository](https://github.com/godotengine/godot-demo-projects)
as well.
There are also a number of other learning resources provided by the community,
such as text and video tutorials, demos, etc. Consult the [community channels](https://godotengine.org/community)
for more info.
[![Travis Build Status](https://travis-ci.org/godotengine/godot.svg?branch=master)](https://travis-ci.org/godotengine/godot)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/bfiihqq6byxsjxxh/branch/master?svg=true)](https://ci.appveyor.com/project/akien-mga/godot)
[![Code Triagers Badge](https://www.codetriage.com/godotengine/godot/badges/users.svg)](https://www.codetriage.com/godotengine/godot)
<!--TODOs
- TODO: add unittests
- TODO: add a proper README description
- TODO: add compiling steps in the README [or a script eventually]
-->
......@@ -634,6 +634,15 @@ uint32_t BulletPhysicsServer::body_get_user_flags(RID p_body) const {
return 0;
}
void BulletPhysicsServer::set_gravity(RID p_body, Vector3 p_gravity)
{
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
body->set_gravity(p_gravity);
}
void BulletPhysicsServer::body_set_param(RID p_body, BodyParameter p_param, float p_value) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
......
......@@ -206,6 +206,7 @@ public:
/// This is not supported by physics server
virtual uint32_t body_get_user_flags(RID p_body) const;
virtual void set_gravity(RID p_body, Vector3 p_gravity) override;
virtual void body_set_param(RID p_body, BodyParameter p_param, float p_value);
virtual float body_get_param(RID p_body, BodyParameter p_param) const;
......
......@@ -485,6 +485,14 @@ void RigidBodyBullet::set_omit_forces_integration(bool p_omit) {
omit_forces_integration = p_omit;
}
void RigidBodyBullet::set_gravity(Vector3 gravity)
{
btVector3 bVec;
G_TO_B(gravity, bVec);
btBody->setGravity(bVec);
}
void RigidBodyBullet::set_param(PhysicsServer::BodyParameter p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer::BODY_PARAM_BOUNCE:
......
......@@ -278,6 +278,8 @@ public:
void set_omit_forces_integration(bool p_omit);
_FORCE_INLINE_ bool get_omit_forces_integration() const { return omit_forces_integration; }
void set_gravity(Vector3 gravity);
void set_param(PhysicsServer::BodyParameter p_param, real_t);
real_t get_param(PhysicsServer::BodyParameter p_param) const;
......
......@@ -335,6 +335,11 @@ void StaticBody::_reload_physics_characteristics() {
}
}
void RigidBody::set_gravity(Vector3 gravity)
{
PhysicsServer::get_singleton()->set_gravity(get_rid(), gravity);
}
void RigidBody::_body_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
......@@ -943,7 +948,8 @@ String RigidBody::get_configuration_warning() const {
}
void RigidBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_gravity","gravity"),
&RigidBody::set_gravity);
ClassDB::bind_method(D_METHOD("set_mode", "mode"), &RigidBody::set_mode);
ClassDB::bind_method(D_METHOD("get_mode"), &RigidBody::get_mode);
......
......@@ -203,6 +203,7 @@ public:
void set_weight(real_t p_weight);
real_t get_weight() const;
void set_gravity(Vector3 gravity);
#ifndef DISABLE_DEPRECATED
void set_friction(real_t p_friction);
......
......@@ -31,6 +31,7 @@
#ifndef PHYSICS_SERVER_SW
#define PHYSICS_SERVER_SW
#include <cassert>
#include "joints_sw.h"
#include "servers/physics_server.h"
#include "shape_sw.h"
......@@ -79,6 +80,14 @@ public:
Vector3 *ptr;
};
/* WARNING: we are not going to support this server, for reference look
* at implementetion in servers/physics_server.h
*/
virtual void set_gravity(RID p_body, Vector3 gravity)
{
assert(false);
};
static void _shape_col_cbk(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata);
virtual RID shape_create(ShapeType p_shape);
......
......@@ -488,6 +488,7 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_enable_continuous_collision_detection", "body", "enable"), &PhysicsServer::body_set_enable_continuous_collision_detection);
ClassDB::bind_method(D_METHOD("body_is_continuous_collision_detection_enabled", "body"), &PhysicsServer::body_is_continuous_collision_detection_enabled);
ClassDB::bind_method(D_METHOD("set_gravity", "body", "gravity"), &PhysicsServer::set_gravity);
ClassDB::bind_method(D_METHOD("body_set_param", "body", "param", "value"), &PhysicsServer::body_set_param);
ClassDB::bind_method(D_METHOD("body_get_param", "body", "param"), &PhysicsServer::body_get_param);
......
......@@ -411,6 +411,7 @@ public:
BODY_PARAM_MAX,
};
virtual void set_gravity(RID p_body, Vector3 gravity) = 0;
virtual void body_set_param(RID p_body, BodyParameter p_param, float p_value) = 0;
virtual float body_get_param(RID p_body, BodyParameter p_param) const = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment