Simulant
21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
simulant
behaviours
movement
smooth_follow.h
1
#pragma once
2
3
#include "../../types.h"
4
#include "../stage_node_behaviour.h"
5
6
7
namespace
smlt
{
8
9
class
Organism;
10
11
namespace
behaviours {
12
13
class
SmoothFollow
:
14
public
StageNodeBehaviour
,
15
public
RefCounted
<SmoothFollow> {
16
17
public
:
18
SmoothFollow
();
19
~
SmoothFollow
();
20
21
const
char
* name()
const override
{
22
return
"Smooth Follow"
;
23
}
24
25
void
late_update(
float
dt)
override
;
26
void
set_target(
ActorPtr
actor);
27
void
set_target(
ParticleSystemPtr
ps);
28
bool
has_target()
const
;
29
StageNode
* target()
const
;
30
31
void
set_follow_distance(
float
dist) { distance_ = dist; }
32
void
set_follow_height(
float
height) { height_ = height; }
33
void
set_damping(
float
damping);
34
void
set_rotation_damping(
float
damping);
35
36
/* When set to false, the node will stay focused
37
* on the target, but movement will stop */
38
void
set_following_enabled(
bool
v);
39
private
:
40
StageNode
* target_ =
nullptr
;
41
42
bool
following_enabled_ =
true
;
43
44
float
distance_ = 10.0;
45
float
height_ = 10.0;
46
47
float
damping_ = 5.0;
48
float
rotation_damping_ = 10.0;
49
50
sig::Connection
destroy_conn_;
51
52
};
53
54
}
55
}
smlt::sig::Connection
Definition:
signal.h:65
smlt::behaviours::StageNodeBehaviour
Definition:
stage_node_behaviour.h:12
smlt::RefCounted
Definition:
managed.h:65
smlt
Definition:
animation.cpp:25
smlt::StageNode
Definition:
stage_node.h:62
smlt::behaviours::SmoothFollow
Definition:
smooth_follow.h:15
smlt::default_init_ptr< Actor >
Generated by
1.8.20