This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddingColliderShapesScript : AsyncScript | |
{ | |
[DataMember(10)] | |
public CameraComponent Camera = null; | |
[DataMember(20)] | |
public Model SphereModel { get; set; } | |
[DataMember(30)] | |
public Model BoxModel { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Xenko.Core.Mathematics; | |
using Xenko.Engine; | |
using Xenko.Graphics; | |
using Xenko.Input; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DebugPhysicsShapes : AsyncScript | |
{ | |
public RenderGroup RenderGroup = RenderGroup.Group7; | |
private Simulation simulation; | |
public override void Cancel() | |
{ | |
// シーンの切り替えの時などに現在のデバッグ表示を消す | |
if (simulation != null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 実行時に頂点とインデックスからConvexHullColliderShapeを作成する(凸包の頂点とインデックスはVHACD/VHACDSharpか自前で用意しておく) | |
// PhysicsComponentがシーンから削除されても作成されたColliderShapeは破棄されてないので注意 | |
var staticCollider = new StaticColliderComponent(); | |
var convexDesc = new ConvexHullColliderShapeDesc | |
{ | |
ConvexHulls = new List<List<List<Vector3>>> { new List<List<Vector3>> { new List<Vector3>(points), }, }, | |
ConvexHullsIndices = new List<List<List<uint>>> { new List<List<uint>> { new List<uint>(indices), } }, | |
}; | |
staticCollider.ColliderShapes.Add(new ColliderShapeAssetDesc { Shape = new PhysicsColliderShape(new[] { convexDesc }), }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NewGameプロジェクトのSphereとGroundの各Entityをシーンから削除して新たに空のEntityを追加 | |
// その追加したEntityに以下のスクリプトを追加して実行する | |
// スペースキーで玉発射 | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Xenko.Core; | |
using Xenko.Core.Mathematics; | |
using Xenko.Engine; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using SiliconStudio.Core.Mathematics; | |
using SiliconStudio.Xenko.Input; | |
using SiliconStudio.Xenko.Engine; | |
using SiliconStudio.Xenko.Rendering; | |
using SiliconStudio.Xenko.Rendering.Materials; |