我看过CannonJS FPS Demo并注意到它使用球体进行球员碰撞。我的角色不是球形,而是盒子或胶囊。
我尝试使用方框进行碰撞,但我无法在X轴或Z轴设置% Get the Computer string (in lower case)
computer=lower(get(handles.computer,'string'))
% Get the Player string (in lower case)
player=lower(get(handles.player,'string'))
% Concatenate the two string
res=[computer player]
% Check for the different combination
switch(res)
case 'rockrock'
set(handles.result,'string','Draw');
case 'rockpaper'
set(handles.result,'string','Player wins');
case 'rockscissor'
set(handles.result,'string','Computer wins');
case 'paperrock'
set(handles.result,'string','Computer wins');
case 'paperpaper'
set(handles.result,'string','Draw');
case 'paperscissor'
set(handles.result,'string','Player wins');
case 'scissorrock'
set(handles.result,'string','Player wins');
case 'scissorpaper'
set(handles.result,'string','Computer wins');
case 'scissorscissor'
set(handles.result,'string','Draw');
otherwise
set(handles.result,'string','Invalid text');
end
或inertia
上lock the rotation。使用angularFactor
时,它会锁定所有轴的旋转,但会严重限制运动。当使用没有限制的盒子形状时,盒子在移动时开始翻滚。
如何通过锁定X和Z轴上的旋转来保持玩家直立?
答案 0 :(得分:1)
在init上将angularDamping设置为1:
var dialogs = (TLDialogs) await client.GetUserDialogsAsync();
var channel = dialogs.chats.lists
.OfType<TLChannel>()
.FirstOrDefault(c => c.title == "channelName");
long access_hash = (long) channel.access_hash;
然后在动画/运动部分使用旋转键处理程序:
progressView.animate(fromAngle: 0, toAngle: 360, duration: 5, completion:
print("go to next lvl")
)
但是不要忘记将每个循环设置在开头回到1. FixedRotation似乎只是防止了某些事情。我也试着自己理解: Here you can read more about it