mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-28 07:20:17 +00:00
...
This commit is contained in:
parent
d06a146fb2
commit
8e41139616
@ -112,8 +112,8 @@ static Vec2 SmoothDamp(Vec2 current, Vec2 target, PyVec2& currentVelocity, float
|
||||
|
||||
// @staticmethod
|
||||
vm->bind(type, "smooth_damp(current: vec2, target: vec2, current_velocity: vec2, smooth_time: float, max_speed: float, delta_time: float) -> vec2", [](VM* vm, ArgsView args){
|
||||
PyVec2 current = CAST(PyVec2, args[0]);
|
||||
PyVec2 target = CAST(PyVec2, args[1]);
|
||||
Vec2 current = CAST(Vec2, args[0]);
|
||||
Vec2 target = CAST(Vec2, args[1]);
|
||||
PyVec2& current_velocity = CAST(PyVec2&, args[2]);
|
||||
float smooth_time = CAST_F(args[3]);
|
||||
float max_speed = CAST_F(args[4]);
|
||||
|
||||
@ -41,8 +41,10 @@ test_vec2_copy = rotated_vec2(test_vec2_copy, radians)
|
||||
assert test_vec2.rotate(radians).__dict__ == test_vec2_copy.__dict__
|
||||
|
||||
# test smooth_damp
|
||||
ret = vec2.smooth_damp(vec2(1, 2), vec2(3, 4), vec2(5, 6), 7, 8, 9)
|
||||
vel = vec2(0, 0)
|
||||
ret = vec2.smooth_damp(vec2(1, 2), vec2(3, 4), vel, 7, 8, 9)
|
||||
assert isinstance(ret, vec2)
|
||||
assert vel.length() > 0
|
||||
|
||||
# test vec3--------------------------------------------------------------------
|
||||
# 生成随机测试目标
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user