Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Body/AllowedDOFs.h
9912 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2023 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56JPH_NAMESPACE_BEGIN78/// Enum used in BodyCreationSettings and MotionProperties to indicate which degrees of freedom a body has9enum class EAllowedDOFs : uint810{11None = 0b000000, ///< No degrees of freedom are allowed. Note that this is not valid and will crash. Use a static body instead.12All = 0b111111, ///< All degrees of freedom are allowed13TranslationX = 0b000001, ///< Body can move in world space X axis14TranslationY = 0b000010, ///< Body can move in world space Y axis15TranslationZ = 0b000100, ///< Body can move in world space Z axis16RotationX = 0b001000, ///< Body can rotate around world space X axis17RotationY = 0b010000, ///< Body can rotate around world space Y axis18RotationZ = 0b100000, ///< Body can rotate around world space Z axis19Plane2D = TranslationX | TranslationY | RotationZ, ///< Body can only move in X and Y axis and rotate around Z axis20};2122/// Bitwise OR operator for EAllowedDOFs23constexpr EAllowedDOFs operator | (EAllowedDOFs inLHS, EAllowedDOFs inRHS)24{25return EAllowedDOFs(uint8(inLHS) | uint8(inRHS));26}2728/// Bitwise AND operator for EAllowedDOFs29constexpr EAllowedDOFs operator & (EAllowedDOFs inLHS, EAllowedDOFs inRHS)30{31return EAllowedDOFs(uint8(inLHS) & uint8(inRHS));32}3334/// Bitwise XOR operator for EAllowedDOFs35constexpr EAllowedDOFs operator ^ (EAllowedDOFs inLHS, EAllowedDOFs inRHS)36{37return EAllowedDOFs(uint8(inLHS) ^ uint8(inRHS));38}3940/// Bitwise NOT operator for EAllowedDOFs41constexpr EAllowedDOFs operator ~ (EAllowedDOFs inAllowedDOFs)42{43return EAllowedDOFs(~uint8(inAllowedDOFs));44}4546/// Bitwise OR assignment operator for EAllowedDOFs47constexpr EAllowedDOFs & operator |= (EAllowedDOFs &ioLHS, EAllowedDOFs inRHS)48{49ioLHS = ioLHS | inRHS;50return ioLHS;51}5253/// Bitwise AND assignment operator for EAllowedDOFs54constexpr EAllowedDOFs & operator &= (EAllowedDOFs &ioLHS, EAllowedDOFs inRHS)55{56ioLHS = ioLHS & inRHS;57return ioLHS;58}5960/// Bitwise XOR assignment operator for EAllowedDOFs61constexpr EAllowedDOFs & operator ^= (EAllowedDOFs &ioLHS, EAllowedDOFs inRHS)62{63ioLHS = ioLHS ^ inRHS;64return ioLHS;65}6667JPH_NAMESPACE_END686970