本文整理汇总了C#中CollisionFlags类的典型用法代码示例。如果您正苦于以下问题:C# CollisionFlags类的具体用法?C# CollisionFlags怎么用?C# CollisionFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollisionFlags类属于命名空间,在下文中一共展示了CollisionFlags类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FixedUpdate
private void FixedUpdate()
{
float speed;
GetInput(out speed);
// always move along the camera forward as it is the direction that it being aimed at
Vector3 desiredMove = transform.forward*m_Input.y + transform.right*m_Input.x;
// get a normal for the surface that is being touched to move along it
RaycastHit hitInfo;
Physics.SphereCast(transform.position, m_CharacterController.radius, Vector3.down, out hitInfo,
m_CharacterController.height/2f);
desiredMove = Vector3.ProjectOnPlane(desiredMove, hitInfo.normal).normalized;
m_MoveDir.x = desiredMove.x*speed;
m_MoveDir.z = desiredMove.z*speed;
if (m_CharacterController.isGrounded)
{
m_MoveDir.y = -m_StickToGroundForce;
}
else
{
m_MoveDir += Physics.gravity*m_GravityMultiplier*Time.fixedDeltaTime;
}
m_CollisionFlags = m_CharacterController.Move(m_MoveDir*Time.fixedDeltaTime);
ProgressStepCycle(speed);
UpdateCameraPosition(speed);
}
开发者ID:kamcneal,项目名称:Conflict-Resolution-CSCI-401,代码行数:29,代码来源:FirstPersonController.cs
示例2: FixedUpdate
private void FixedUpdate()
{
//LookRotation(transform, m_Camera.transform);
// always move along the camera forward as it is the direction that it being aimed at
Vector3 desiredMove = transform.forward * m_Input.z + transform.right * m_Input.x + transform.up * m_Input.y;
// get a normal for the surface that is being touched to move along it
RaycastHit hitInfo;
Physics.SphereCast(transform.position, m_CharacterController.radius, Vector3.down, out hitInfo,
m_CharacterController.height / 2f);
desiredMove = Vector3.ProjectOnPlane(desiredMove, hitInfo.normal).normalized;
m_MoveDir.x = desiredMove.x * Math.Abs(translationSpeeds[0]);
m_MoveDir.z = desiredMove.z * Math.Abs(translationSpeeds[2]);
m_MoveDir.y = desiredMove.y * Math.Abs(translationSpeeds[1]);
//desiredMove.x = desiredMove.x * Math.Abs(translationSpeeds[0]);
//desiredMove.z = desiredMove.z * Math.Abs(translationSpeeds[2]);
//desiredMove.y = desiredMove.y * Math.Abs(translationSpeeds[1]);
m_CollisionFlags = m_CharacterController.Move(m_MoveDir * Time.fixedDeltaTime);
Vector3 velocity = new Vector3(translationSpeeds[0], translationSpeeds[1], translationSpeeds[2]);
float speed = velocity.magnitude;
ProgressStepCycle(speed);
handleSounds();
}
开发者ID:Nihav-Jain,项目名称:Space-Between,代码行数:27,代码来源:CustomCharacterController.cs
示例3: FixedUpdate
void FixedUpdate()
{
if(Input.GetAxis("Vertical") < -0.5f && _controller.isGrounded)
{
_moveDirection.x = 0;
}
else
{
_moveDirection.x = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime;
_moveDirection.x = Mathf.Clamp(_moveDirection.x, -maxMoveSpeed, maxMoveSpeed);
}
_moveDirection.y = Mathf.Max(-Mathf.Abs(maxFallSpeed), _moveDirection.y);
_cf = _controller.Move(_moveDirection);
if(!_controller.isGrounded)
{
_moveDirection.y -= gravity * Time.deltaTime;
}
else
{
if(_cf == CollisionFlags.CollidedBelow)
{
_moveDirection.y = -0.1f;
_canDoubleJump = true;
}
}
if(_cf == CollisionFlags.CollidedAbove)
{
//audioEffects.PlayCollideSound();
_moveDirection.y = -0.1f;
}
}
开发者ID:kaluluosi,项目名称:quad,代码行数:32,代码来源:CharacterMovement.cs
示例4: GetMove
void GetMove()
{
float horizontal = CrossPlatformInputManager.GetAxis("Horizontal");
float vertical = CrossPlatformInputManager.GetAxis("Vertical");
float speed = Input.GetKey(runKey) ? speed_run : speed_walk;
Vector3 desiredDir = (transform.forward*vertical + transform.right*horizontal)
* Time.deltaTime * speed;
// apply gtavity
desiredDir += Physics.gravity * Time.deltaTime;
m_CollisionFlags = cc.Move(desiredDir);
}
开发者ID:HaikunHuang,项目名称:TutorialForTaikeQ,代码行数:15,代码来源:CharacterMotor.cs
示例5: Update
// Update is called once per frame
void Update()
{
// if (Mathf.Abs (Input.GetAxis ("Horizontal")) > 0) {
// _myTransform.Rotate(0, Input.GetAxis("Horizontal") * Time.deltaTime * rotationSpeed, 0);
// }
if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Return))
{
// DamageArea.SetActive (false);
AttackArea.SetActive (true);
}
else
{
AttackArea.GetComponent<Attack>().ResetSize();
// DamageArea.SetActive (true);
}
if (_controller.isGrounded) {
_moveDirection = new Vector3(Input.GetAxis("Horizontal"),0, Input.GetAxis("Vertical"));
_moveDirection = _myTransform.TransformDirection(_moveDirection).normalized;
_moveDirection *= moveSpeed;
if(Input.GetKeyDown(KeyCode.Space)){
_moveDirection.y += jumpHeight;
}
}
else {
_moveDirection = new Vector3(Input.GetAxis("Horizontal"), _moveDirection.y, Input.GetAxis("Vertical"));
_moveDirection = transform.TransformDirection(_moveDirection);
_moveDirection.x *= moveSpeed;
_moveDirection.z *= moveSpeed;
if ((_collisionFlags & CollisionFlags.CollidedBelow) == 0){
}
}
_moveDirection.y -= gravity * Time.deltaTime;
_collisionFlags = _controller.Move(_moveDirection * Time.deltaTime);
}
开发者ID:BrianPickens,项目名称:BriJames,代码行数:43,代码来源:MoveSide.cs
示例6: FixedUpdate
private void FixedUpdate()
{
float speed;
GetInput(out speed);
if (m_MovementDirectionNode == null)
{
m_MovementDirectionNode = GameObject.Find(MovementDirectionNodeName);
return;
}
Vector3 movementForward = m_MovementDirectionNode.transform.forward;
Vector3 movementRight = m_MovementDirectionNode.transform.right;
// No fly for the moment
movementForward.y = 0.0f;
movementForward.Normalize();
movementRight.y = 0.0f;
movementRight.Normalize();
Vector3 desiredMove;
if (Straffe)
{
desiredMove = movementForward * m_Input.y + movementRight * m_Input.x;
}
else
{
desiredMove = movementForward * m_Input.y;
this.transform.RotateAround(m_Head.transform.position, Vector3.up, m_Input.x * RotationSpeed * Time.fixedDeltaTime);
}
m_Movement.x = desiredMove.x * speed;
m_Movement.z = desiredMove.z * speed;
if (!m_CharacterController.isGrounded)
{
m_Movement += Physics.gravity * GravityMultiplier * Time.fixedDeltaTime;
}
m_CollisionFlags = m_CharacterController.Move(m_Movement * Time.fixedDeltaTime);
}
开发者ID:ReMinoer,项目名称:SolarVR,代码行数:41,代码来源:VRNavigationController.cs
示例7: update
void update()
{
Vector3 moveVec = Vector3.zero;
if(moveLeft.IsActive)
{
moveVec.x -= Movespeed;
}
if(moveRight.IsActive)
{
moveVec.x += Movespeed;
}
controller.Move(moveVec * Time.deltaTime);
//if(Jump.IsActive)
//{
//moveVec.y -= Gravity;
//}
prevFlags = controller.Move(moveVec * Time.deltaTime);
//if(HideFlags.Has<CollisionFlags>(CollidedSides))
//{
//Debug.Log("I HIT SOMETHING..ON THE SIDE");
//}
}
开发者ID:johncanace,项目名称:move,代码行数:24,代码来源:PlatformController.cs
示例8: SetCollisionFlags
public abstract CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags);
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:1,代码来源:BSApiTemplate.cs
示例9: RemoveFromCollisionFlags
public abstract CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags);
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:1,代码来源:BSApiTemplate.cs
示例10: FixedUpdate
//.........这里部分代码省略.........
m_MoveDir.x = desiredMove.x*speed;
m_MoveDir.z = desiredMove.z*speed;
PlayRespireSound();
//Actions joueur
if(m_Briquets[indexBriquet]!=null)
{
//allumerBriquet
if(Input.GetButton("Briquet"))
{
//Si un briquet n'est pas déja allumé
if(!m_Briquets[indexBriquet].activer)
{
//Si il n'y a pas de briquet déja commencé
if(GameObject.FindGameObjectWithTag("Briquet")==null)
{
Instantiate(m_Briquets[indexBriquet]);
m_Briquets[indexBriquet] = GameObject.FindGameObjectWithTag("Briquet").GetComponent<Briquet>();
//Si il y a une allumette. Éteint la
}
if(GameObject.FindGameObjectWithTag("Allumettes")!=null)
{
m_NbrAllumettes--;
allumette.SetActive (false);
DestroyObject(GameObject.FindGameObjectWithTag("Allumettes"));
}
m_Briquets[indexBriquet].activer=true;
m_Briquets[indexBriquet].enabled=true;
lighter.SetActive(true);
}
//Si le briquet est déja allumé
else
{
m_Briquets[indexBriquet].activer=false;
m_Briquets[indexBriquet].enabled=false;
lighter.SetActive(false);
}
}
//Si le briquet est vide, le jeté
if (m_Briquets[indexBriquet].m_Essence <= 0)
{
m_Briquets[indexBriquet].activer=false;
lighter.SetActive(false);
DestroyObject(m_Briquets[indexBriquet].gameObject);
indexBriquet++;
}
}
if(Input.GetButton("Alumettes"))
{
//allumerAllumettes
if(m_NbrAllumettes>0)
{
//Si il y a un briquet, l'éteindre, mais le conservé
if(GameObject.FindGameObjectWithTag("Briquet")!=null)
{
m_Briquets[indexBriquet].activer=false;
m_Briquets[indexBriquet].enabled = false;
lighter.SetActive(false);
}
//Si il ny a pas d'allumettes déja allumé
if(GameObject.FindGameObjectWithTag("Allumettes")==null)
{
Instantiate(m_Allumettes);
allumette.SetActive (true);
GameObject.FindGameObjectWithTag("Allumettes").GetComponent<Allumettes>().activer=true;
}
}
}
//Si l'allumette est morte
if(GameObject.FindGameObjectWithTag("Allumettes")!=null)
if(GameObject.FindGameObjectWithTag("Allumettes").GetComponent<Allumettes>().m_Duree<=0)
{
m_NbrAllumettes--;
allumette.SetActive(false);
DestroyObject(GameObject.FindGameObjectWithTag("Allumettes"));
}
if (m_CharacterController.isGrounded)
{
m_MoveDir.y = -m_StickToGroundForce;
if (m_Jump)
{
m_MoveDir.y = m_JumpSpeed;
PlayJumpSound();
m_Jump = false;
m_Jumping = true;
}
}
else
{
m_MoveDir += Physics.gravity*m_GravityMultiplier*Time.fixedDeltaTime;
}
m_CollisionFlags = m_CharacterController.Move(m_MoveDir*Time.fixedDeltaTime);
ProgressStepCycle(speed);
UpdateCameraPosition(speed);
}
开发者ID:ConjureETS,项目名称:EscapeTheRoom,代码行数:101,代码来源:FirstPersonController.cs
示例11: SetCollisionFlags
public void SetCollisionFlags(CollisionFlags flags)
{
m_collisionFlags = flags;
}
开发者ID:bsamuels453,项目名称:BulletXNA,代码行数:4,代码来源:CollisionObject.cs
示例12: FixedUpdate
private void FixedUpdate()
{
float speed;
GetInput(out speed);
// always move along the camera forward as it is the direction that it being aimed at
Vector3 desiredMove = transform.forward*m_Input.y + transform.right*m_Input.x;
// get a normal for the surface that is being touched to move along it
RaycastHit hitInfo;
Physics.SphereCast(transform.position, m_CharacterController.radius, Vector3.down, out hitInfo,
<<<<<<< HEAD
m_CharacterController.height/2f);
=======
m_CharacterController.height/2f, ~0, QueryTriggerInteraction.Ignore);
>>>>>>> parent of cb0a668... Refreshing Project...
desiredMove = Vector3.ProjectOnPlane(desiredMove, hitInfo.normal).normalized;
m_MoveDir.x = desiredMove.x*speed;
m_MoveDir.z = desiredMove.z*speed;
if (m_CharacterController.isGrounded)
{
m_MoveDir.y = -m_StickToGroundForce;
if (m_Jump)
{
m_MoveDir.y = m_JumpSpeed;
PlayJumpSound();
m_Jump = false;
m_Jumping = true;
}
}
else
{
m_MoveDir += Physics.gravity*m_GravityMultiplier*Time.fixedDeltaTime;
}
m_CollisionFlags = m_CharacterController.Move(m_MoveDir*Time.fixedDeltaTime);
ProgressStepCycle(speed);
UpdateCameraPosition(speed);
<<<<<<< HEAD
=======
m_MouseLook.UpdateCursorLock();
>>>>>>> parent of cb0a668... Refreshing Project...
}
开发者ID:jdrunyan,项目名称:Retake,代码行数:47,代码来源:FirstPersonController.cs
示例13: RemoveFromCollisionFlags
public override CollisionFlags RemoveFromCollisionFlags(BulletBody pCollisionObject, CollisionFlags pcollisionFlags)
{
CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).body;
CollisionFlags existingcollisionFlags = (CollisionFlags)(uint)collisionObject.GetCollisionFlags();
existingcollisionFlags &= ~pcollisionFlags;
collisionObject.SetCollisionFlags((BulletXNA.BulletCollision.CollisionFlags)(uint)existingcollisionFlags);
return (CollisionFlags)(uint)existingcollisionFlags;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:8,代码来源:BSAPIXNA.cs
示例14: SetCollisionFlags
//(m_mapInfo.terrainBody.ptr, CollisionFlags.CF_STATIC_OBJECT);
public override CollisionFlags SetCollisionFlags(BulletBody pCollisionObject, CollisionFlags collisionFlags)
{
CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody;
collisionObject.SetCollisionFlags((BulletXNA.BulletCollision.CollisionFlags) (uint) collisionFlags);
return (CollisionFlags)collisionObject.GetCollisionFlags();
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:7,代码来源:BSAPIXNA.cs
示例15: Move
void Move(float vertical, float horizontal)
{
// 카메라의 위치
Transform camTransform = Camera.main.transform;
// 캐릭터의 앞 방향
Vector3 forward = camTransform.TransformDirection(Vector3.forward);
forward = forward.normalized;
// 캐릭터의 우측 방향
Vector3 right = new Vector3(forward.z, 0f, -forward.x);
// 이동 방향 벡터
Vector3 targetVector = vertical * forward + horizontal * right;
targetVector = targetVector.normalized;
// 이동 방향 계산
moveDirection = Vector3.RotateTowards(moveDirection, targetVector, rotateSpeed * Mathf.Deg2Rad * Time.deltaTime, 500f);
moveDirection = moveDirection.normalized;
// 이동 양 계산
Vector3 grav = new Vector3(0f, verticalSpeed, 0f);
Vector3 movementAmount = (moveDirection * moveSpeed * Time.deltaTime) + grav;
// 캐릭터를 이동시킨다. 캐릭터가 다른 오브젝트와 마지막으로 충돌된 부분이 어딘지 알 수 있다.
// 캐릭터가 공중에 있는지 땅에 있는지 알 수 있다
collisionflags = characterController.Move(movementAmount);
}
开发者ID:ohs108,项目名称:unity_lecture,代码行数:27,代码来源:SamuraiControl.cs
示例16: Update
void Update()
{
if (!IsControllable)
{
return;
}
if (IsMoving)
{
Vector3 movement = (moveVector + Vector3.down * gravity) * Time.deltaTime;
collisionFlags = characterController.Move(movement);
if (trans.forward != moveVector.normalized)
{
if (LerpRotation)
{
Vector3 direction = Vector3.Lerp(trans.forward, moveVector, Time.deltaTime * angularSpeed);
trans.localRotation = Quaternion.LookRotation(direction);
}
else
{
trans.localRotation = Quaternion.LookRotation(moveVector);
}
}
}
}
开发者ID:sigmadruid,项目名称:NewMaze,代码行数:26,代码来源:MoveScript.cs
示例17: fixUpdate
public void fixUpdate()
{
float speed;
GetInput(out speed);
// always move along the camera forward as it is the direction that it being aimed at
Vector3 desiredMove = playerObject.transform.forward * input.y + playerObject.transform.right * input.x;
// get a normal for the surface that is being touched to move along it
RaycastHit hitInfo;
Physics.SphereCast(playerObject.transform.position, characterController.radius, Vector3.down, out hitInfo,
characterController.height / 2f);
desiredMove = Vector3.ProjectOnPlane(desiredMove, hitInfo.normal).normalized;
moveDir.x = desiredMove.x * speed;
moveDir.z = desiredMove.z * speed;
if (characterController.isGrounded) {
moveDir.y = -m_StickToGroundForce;
} else {
moveDir += Physics.gravity * m_GravityMultiplier * Time.fixedDeltaTime;
}
if (isJumping)
moveDir.y = playerJumpSpeed;
collisionFlags = characterController.Move(moveDir * Time.fixedDeltaTime);
UpdateCameraPosition(speed);
}
开发者ID:Baensi,项目名称:Assets,代码行数:29,代码来源:UnderwaterMovements.cs
示例18: FixedUpdate
void FixedUpdate ()
{
moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
moveDirection = transform.TransformDirection (moveDirection);
moveDirection *= speed;
flags = controller.Move (moveDirection * Time.deltaTime);
}
开发者ID:markdion,项目名称:Unity-Projects,代码行数:8,代码来源:FPSFlyerMouse.cs
示例19: Move
private void Move()
{
movement = moveDirection * moveSpeed + new Vector3(0, verticalSpeed, 0);
movement *= Time.deltaTime;
collisionFlags = controller.Move(movement);
Vector3 newDir = Vector3.RotateTowards( transform.forward, moveDirection, Time.deltaTime * rotationSpeed, 0.0f );
transform.rotation = Quaternion.LookRotation(newDir);
}
开发者ID:CamdenSegal,项目名称:Old-Tjikko,代码行数:8,代码来源:BeastMovement.cs
示例20: Update
// Update is called once per frame
void Update()
{
ApplyGravity ();
v = Input.GetAxisRaw("Vertical");
h = Input.GetAxisRaw("Horizontal");
moveDirection = new Vector3(h, verticalSpeed , v).normalized;
movement = moveDirection * moveSpeed * Time.deltaTime;
controller.Move(movement);
collisionFlags = controller.Move(movement);
}
开发者ID:CamdenSegal,项目名称:Old-Tjikko,代码行数:14,代码来源:Movement.cs
注:本文中的CollisionFlags类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论