feat: implemented spawn_at_position for tunnels_player
This commit is contained in:
parent
675b2e53ec
commit
7b8ba8739e
|
@ -115,6 +115,11 @@ Node *TunnelsPlayer::to_node() {
|
|||
return Object::cast_to<Node>(this);
|
||||
}
|
||||
|
||||
void TunnelsPlayer::spawn_at_position(Transform3D const &at) {
|
||||
this->character->set_global_transform(at);
|
||||
this->set_global_basis(at.get_basis());
|
||||
}
|
||||
|
||||
void TunnelsPlayer::horizontal_move_input(Ref<InputEvent> event, float value) {
|
||||
this->move_input.x = value;
|
||||
}
|
||||
|
@ -196,6 +201,7 @@ void TunnelsPlayer::initialize_character() {
|
|||
return;
|
||||
if(player_scene->get_state()->get_node_type(0) != StringName("CharacterActor"))
|
||||
return;
|
||||
UtilityFunctions::print("initialize_character pos: ", this->get_global_position());
|
||||
// instantiate and store the player character
|
||||
this->character = Object::cast_to<CharacterActor>(player_scene->instantiate());
|
||||
this->get_parent()->add_child(this->character);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef TUNNELS_PLAYER_HPP
|
||||
#define TUNNELS_PLAYER_HPP
|
||||
|
||||
#include "godot_cpp/variant/transform3d.hpp"
|
||||
#include "utils/player.hpp"
|
||||
#include "utils/player_input.hpp"
|
||||
#include <godot_cpp/classes/camera3d.hpp>
|
||||
|
@ -32,6 +33,7 @@ public:
|
|||
|
||||
virtual void setup_player_input(PlayerInput *input) override;
|
||||
virtual Node *to_node() override;
|
||||
virtual void spawn_at_position(Transform3D const &at) override;
|
||||
|
||||
void horizontal_move_input(Ref<InputEvent> event, float value);
|
||||
void vertical_move_input(Ref<InputEvent> event, float value);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 78e6bb2cf18aebf3edd72907f982c811caac9eea
|
||||
Subproject commit 90d8d626a011b10560ec794ee0a06a802ffa940a
|
Loading…
Reference in a new issue