public void ChangeParam( int teamId, BezierParam mass, float velocityInfluence, BezierParam structStiffness, bool useBend, BezierParam bendStiffness, bool useNear, BezierParam nearStiffness ) { var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; int group = teamData.restoreDistanceGroupIndex; if (group < 0) { return; } var cdata = groupList[group]; cdata.mass.Setup(mass); cdata.velocityInfluence = velocityInfluence; cdata.structStiffness.Setup(structStiffness); cdata.bendStiffness.Setup(bendStiffness); cdata.nearStiffness.Setup(nearStiffness); cdata.useBend = useBend ? 1 : 0; cdata.useNear = useNear ? 1 : 0; groupList[group] = cdata; }
//========================================================================================= public int AddGroup(int teamId, bool active, BezierParam power, float velocityInfluence, RotationData[] dataArray, ReferenceDataIndex[] refDataArray) { if (dataArray == null || dataArray.Length == 0 || refDataArray == null || refDataArray.Length == 0) { return(-1); } var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; var gdata = new GroupData(); gdata.teamId = teamId; gdata.active = active ? 1 : 0; gdata.restorePower.Setup(power); gdata.velocityInfluence = velocityInfluence; gdata.dataChunk = dataList.AddChunk(dataArray.Length); gdata.refChunk = refDataList.AddChunk(refDataArray.Length); // チャンクデータコピー dataList.ToJobArray().CopyFromFast(gdata.dataChunk.startIndex, dataArray); refDataList.ToJobArray().CopyFromFast(gdata.refChunk.startIndex, refDataArray); int group = groupList.Add(gdata); return(group); }
//========================================================================================= public int AddGroup(int teamId, bool active, BezierParam stretchStiffness, BezierParam shearStiffness, VolumeData[] dataArray, ReferenceDataIndex[] refDataArray, int writeBufferCount) { if (dataArray == null || dataArray.Length == 0 || refDataArray == null || refDataArray.Length == 0 || writeBufferCount == 0) { return(-1); } var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; // グループデータ作成 var gdata = new GroupData(); gdata.teamId = teamId; gdata.active = active ? 1 : 0; gdata.stretchStiffness.Setup(stretchStiffness); gdata.shearStiffness.Setup(shearStiffness); gdata.dataChunk = dataList.AddChunk(dataArray.Length); gdata.groupIndexChunk = groupIndexList.AddChunk(dataArray.Length); gdata.refDataChunk = refDataList.AddChunk(refDataArray.Length); gdata.writeDataChunk = writeBuffer.AddChunk(writeBufferCount); // チャンクデータコピー dataList.ToJobArray().CopyFromFast(gdata.dataChunk.startIndex, dataArray); refDataList.ToJobArray().CopyFromFast(gdata.refDataChunk.startIndex, refDataArray); int group = groupList.Add(gdata); // データごとのグループインデックス groupIndexList.Fill(gdata.groupIndexChunk, (short)group); return(group); }
public CurveParam(BezierParam bezier) { useCurve = 0; sval = 0; eval = 0; cval = 0; Setup(bezier); }
public void SetWorldInfluence(int teamId, float maxSpeed, BezierParam moveInfluence, BezierParam rotInfluence) { var data = teamWorldInfluenceList[teamId]; data.maxMoveSpeed = maxSpeed; data.moveInfluence = new CurveParam(moveInfluence); data.rotInfluence = new CurveParam(rotInfluence); teamWorldInfluenceList[teamId] = data; }
/// <summary> /// ベジェ曲線のデータを格納 /// </summary> /// <param name="bezier"></param> public void Setup(BezierParam bezier) { useCurve = bezier.UseCurve ? 1 : 0; sval = bezier.StartValue; eval = bezier.EndValue; // 制御点を事前計算しておく cval = math.lerp(eval, sval, math.saturate(bezier.CurveValue * 0.5f + 0.5f)); }
/// <summary> /// ワールド移動影響設定 /// </summary> /// <param name="teamId"></param> /// <param name="worldMoveInfluence"></param> public void SetWorldInfluence(int teamId, BezierParam moveInfluence, BezierParam rotInfluence, bool resetTeleport, float teleportDistance, float teleportRotation) { var data = teamWorldInfluenceList[teamId]; data.moveInfluence = new CurveParam(moveInfluence); data.rotInfluence = new CurveParam(rotInfluence); data.resetTeleport = resetTeleport ? 1 : 0; data.teleportDistance = teleportDistance; data.teleportRotation = teleportRotation; teamWorldInfluenceList[teamId] = data; }
/// <summary> /// ワールド移動影響設定 /// </summary> /// <param name="teamId"></param> /// <param name="worldMoveInfluence"></param> public void SetWorldInfluence(int teamId, float maxSpeed, BezierParam moveInfluence, BezierParam rotInfluence, bool resetTeleport, float teleportDistance, float teleportRotation, float resetStabilizationTime) { var data = teamWorldInfluenceList[teamId]; data.maxMoveSpeed = maxSpeed; data.moveInfluence = new CurveParam(moveInfluence); data.rotInfluence = new CurveParam(rotInfluence); data.resetTeleport = resetTeleport ? 1 : 0; data.teleportDistance = teleportDistance; data.teleportRotation = teleportRotation; data.stabilizationTime = resetStabilizationTime; teamWorldInfluenceList[teamId] = data; }
public void ChangeParam(int teamId, bool active, BezierParam stiffness) { var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; int group = teamData.triangleBendGroupIndex; if (group < 0) { return; } var gdata = groupList[group]; gdata.active = active ? 1 : 0; gdata.stiffness.Setup(stiffness); groupList[group] = gdata; }
//========================================================================================= public int AddGroup(int teamId, bool active, BezierParam limitLength, float3 axisRatio, float velocityInfluence) { var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; var gdata = new GroupData(); gdata.teamId = teamId; gdata.active = active ? 1 : 0; gdata.limitLength.Setup(limitLength); gdata.axisRatio = axisRatio; gdata.velocityInfluence = velocityInfluence; int group = groupList.Add(gdata); return(group); }
public void ChangeParam(int teamId, bool active, BezierParam distance, BezierParam radius) { var teamData = Manager.Team.teamDataList[teamId]; int group = teamData.penetrationGroupIndex; if (group < 0) { return; } var gdata = groupList[group]; gdata.active = active ? 1 : 0; gdata.distance.Setup(distance); gdata.radius.Setup(radius); groupList[group] = gdata; }
public void ChangeParam(int teamId, bool active, BezierParam power, float velocityInfluence) { var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; int group = teamData.restoreRotationGroupIndex; if (group < 0) { return; } var gdata = groupList[group]; gdata.active = active ? 1 : 0; gdata.restorePower.Setup(power); gdata.velocityInfluence = velocityInfluence; groupList[group] = gdata; }
public void ChangeParam(int teamId, bool active, BezierParam limitLength, float3 axisRatio, float velocityInfluence) { var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; int group = teamData.clampPositionGroupIndex; if (group < 0) { return; } var gdata = groupList[group]; gdata.active = active ? 1 : 0; gdata.limitLength.Setup(limitLength); gdata.axisRatio = axisRatio; gdata.velocityInfluence = velocityInfluence; groupList[group] = gdata; }
//========================================================================================= public int AddGroup( int teamId, bool active, BezierParam maxAngle, //BezierParam stiffness, float velocityInfluence, ClampRotationData[] dataArray, ClampRotationRootInfo[] rootInfoArray ) { if (dataArray == null || dataArray.Length == 0 || rootInfoArray == null || rootInfoArray.Length == 0) { return(-1); } var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; var gdata = new GroupData(); gdata.teamId = teamId; gdata.active = active ? 1 : 0; gdata.maxAngle.Setup(maxAngle); //gdata.stiffness.Setup(stiffness); gdata.velocityInfluence = velocityInfluence; gdata.dataChunk = dataList.AddChunk(dataArray.Length); gdata.rootInfoChunk = rootInfoList.AddChunk(rootInfoArray.Length); // チャンクデータコピー dataList.ToJobArray().CopyFromFast(gdata.dataChunk.startIndex, dataArray); rootInfoList.ToJobArray().CopyFromFast(gdata.rootInfoChunk.startIndex, rootInfoArray); int group = groupList.Add(gdata); // ルートごとのチームインデックス var c = rootTeamList.AddChunk(rootInfoArray.Length); rootTeamList.Fill(c, teamId); // 作業バッファ lengthBuffer.AddChunk(dataArray.Length); return(group); }
public void ChangeParam( int teamId, bool active, BezierParam maxAngle, //BezierParam stiffness, float velocityInfluence ) { var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; int group = teamData.clampRotationGroupIndex; if (group < 0) { return; } var gdata = groupList[group]; gdata.active = active ? 1 : 0; gdata.maxAngle.Setup(maxAngle); //gdata.stiffness.Setup(stiffness); gdata.velocityInfluence = velocityInfluence; groupList[group] = gdata; }
//========================================================================================= public int AddGroup( int teamId, BezierParam mass, float velocityInfluence, BezierParam structStiffness, RestoreDistanceData[] structDataArray, ReferenceDataIndex[] structRefDataArray, bool useBend, BezierParam bendStiffness, RestoreDistanceData[] bendDataArray, ReferenceDataIndex[] bendRefDataArray, bool useNear, BezierParam nearStiffness, RestoreDistanceData[] nearDataArray, ReferenceDataIndex[] nearRefDataArray ) { if (structDataArray == null || structDataArray.Length == 0 || structRefDataArray == null || structRefDataArray.Length == 0) { return(-1); } var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; var gdata = new RestoreDistanceGroupData(); gdata.teamId = teamId; gdata.mass.Setup(mass); gdata.velocityInfluence = velocityInfluence; gdata.useBend = useBend ? 1 : 0; gdata.useNear = useNear ? 1 : 0; gdata.structStiffness.Setup(structStiffness); gdata.structDataChunk = dataList[StructType].AddChunk(structDataArray.Length); gdata.structRefChunk = refDataList[StructType].AddChunk(structRefDataArray.Length); // チャンクデータコピー dataList[StructType].ToJobArray().CopyFromFast(gdata.structDataChunk.startIndex, structDataArray); refDataList[StructType].ToJobArray().CopyFromFast(gdata.structRefChunk.startIndex, structRefDataArray); if (bendDataArray != null && bendDataArray.Length > 0) { gdata.bendStiffness.Setup(bendStiffness); gdata.bendDataChunk = dataList[BendType].AddChunk(bendDataArray.Length); gdata.bendRefChunk = refDataList[BendType].AddChunk(bendRefDataArray.Length); // チャンクデータコピー dataList[BendType].ToJobArray().CopyFromFast(gdata.bendDataChunk.startIndex, bendDataArray); refDataList[BendType].ToJobArray().CopyFromFast(gdata.bendRefChunk.startIndex, bendRefDataArray); } if (nearDataArray != null && nearDataArray.Length > 0) { gdata.nearStiffness.Setup(nearStiffness); gdata.nearDataChunk = dataList[NearType].AddChunk(nearDataArray.Length); gdata.nearRefChunk = refDataList[NearType].AddChunk(nearRefDataArray.Length); // チャンクデータコピー dataList[NearType].ToJobArray().CopyFromFast(gdata.nearDataChunk.startIndex, nearDataArray); refDataList[NearType].ToJobArray().CopyFromFast(gdata.nearRefChunk.startIndex, nearRefDataArray); } return(groupList.Add(gdata)); }
public void SetMaxVelocity(int teamId, BezierParam maxVelocity) { teamMaxVelocityList[teamId] = new CurveParam(maxVelocity); }
public void SetDrag(int teamId, BezierParam drag) { teamDragList[teamId] = new CurveParam(drag); }
public void SetDirectionalDamping(int teamId, BezierParam directionalDamping) { teamDirectionalDampingList[teamId] = new CurveParam(directionalDamping); }
public void SetGravity(int teamId, BezierParam gravity) { teamGravityList[teamId] = new CurveParam(gravity); }
public void SetMass(int teamId, BezierParam mass) { teamMassList[teamId] = new CurveParam(mass); }
//========================================================================================= /// <summary> /// ベジェ曲線から横軸位置(t=0.0~1.0)の縦軸値を取得する /// </summary> /// <param name="bparam">曲線パラメータ</param> /// <param name="t">横軸位置(0.0~1.0)</param> /// <returns></returns> public static float GetBezierValue(BezierParam bparam, float t) { return(GetBezierValue(bparam.StartValue, bparam.EndValue, bparam.CurveValue, t)); }
public int AddGroup(int teamId, bool active, ClothParams.PenetrationMode mode, BezierParam distance, BezierParam radius, PenetrationData[] moveLimitDataList, ReferenceDataIndex[] refDataArray) { var teamData = MagicaPhysicsManager.Instance.Team.teamDataList[teamId]; var gdata = new GroupData(); gdata.teamId = teamId; gdata.active = active ? 1 : 0; gdata.mode = (int)mode; gdata.distance.Setup(distance); gdata.radius.Setup(radius); gdata.dataChunk = dataList.AddChunk(moveLimitDataList.Length); gdata.refDataChunk = refDataList.AddChunk(refDataArray.Length); // チャンクデータコピー dataList.ToJobArray().CopyFromFast(gdata.dataChunk.startIndex, moveLimitDataList); refDataList.ToJobArray().CopyFromFast(gdata.refDataChunk.startIndex, refDataArray); int group = groupList.Add(gdata); return(group); }