大家好,感谢大家阅读我的问题,我正在使用团结5创造永远的赛跑游戏,我希望我的角色跳过障碍物,但我希望对象在跳跃期间向前移动,但我有跳跃花费很短的时间,角色保持非常接近地面,而不是前进 - 跳跃 - 即使我在代码中施加一个力,所以我该怎么办?
void Start ()
{
anim = GetComponent<Animator>();
rbody = GetComponent<Rigidbody>();
verticalJumpPower = 80f;
horizantalJumpPower = 1000f;
playerVelocity = 10f;
isGrounded = true;
}
***in update function :***
if(Input.GetKeyDown (KeyCode.UpArrow))
{
rbody.AddForce(new Vector3(0,verticalJumpPower,horizantalJumpPower));
anim.SetBool("jump",true);
isGrounded = false;
}
答案 0 :(得分:1)
我添加<svg width="100%" height="300px">
<defs>
<filter id="dropshadow" width="130%" height="130%">
<feOffset result="offOut" in="SourceGraphic" dx="5" dy="5"></feOffset>
<feColorMatrix result="matrixOut" in="offOut" type="matrix"
values="0.2 0 0 0 0 0 0.2 0 0 1 0 0 0.2 0 0 0 0 0 1 0" />
<feGaussianBlur result="blurOut" in="matrixOut" stdDeviation="2"></feGaussianBlur>
<feBlend in="SourceGraphic" in2="blurOut" mode="normal"></feBlend>
</filter>
</defs>
<rect x="20" y="20" width="50" height="50" fill="red" filter="url(#dropshadow)"></rect>
</svg>
并且有效