4 * License : The MIT License
5 * Copyright(c) 2010 MikuToga Partners
8 package jp.sfjp.mikutoga.pmd.model;
10 import java.util.ArrayList;
11 import java.util.Collection;
12 import jp.sfjp.mikutoga.corelib.I18nText;
13 import jp.sfjp.mikutoga.math.MkPos3D;
14 import jp.sfjp.mikutoga.pmd.Rad3d;
15 import jp.sfjp.mikutoga.pmd.RigidBehaviorType;
20 public class RigidInfo implements SerialNumbered {
22 private final I18nText rigidName = new I18nText();
24 private RigidBehaviorType behaviorType = RigidBehaviorType.FOLLOWBONE;
26 private final RigidShape rigidShape = new RigidShape();
27 private final MkPos3D position = new MkPos3D();
28 private final Rad3d rotation = new Rad3d();
30 private BoneInfo linkedBone;
32 private final DynamicsInfo dynamicsInfo = new DynamicsInfo();
34 private final Collection<RigidGroup> throughGroupColl =
37 private RigidGroup rigidGroup;
39 private int rigidSerialNo = -1;
55 public I18nText getRigidName(){
56 return this.rigidName;
63 public RigidBehaviorType getBehaviorType(){
64 return this.behaviorType;
69 * @param type 剛体の振る舞い種別。
70 * @throws NullPointerException 引数がnull
72 public void setBehaviorType(RigidBehaviorType type)
73 throws NullPointerException{
74 if(type == null) throw new NullPointerException();
75 this.behaviorType = type;
83 public RigidShape getRigidShape(){
84 return this.rigidShape;
91 public MkPos3D getPosition(){
99 public Rad3d getRotation(){
100 return this.rotation;
107 public BoneInfo getLinkedBone(){
108 return this.linkedBone;
115 public void setLinkedBone(BoneInfo bone){
116 this.linkedBone = bone;
124 public DynamicsInfo getDynamicsInfo(){
125 return this.dynamicsInfo;
132 public Collection<RigidGroup> getThroughGroupColl(){
133 return this.throughGroupColl;
140 public RigidGroup getRigidGroup(){
141 return this.rigidGroup;
146 * @param group 所属する剛体グループ
148 public void setRigidGroup(RigidGroup group){
149 this.rigidGroup = group;
155 * @param num {@inheritDoc}
158 public void setSerialNumber(int num){
159 this.rigidSerialNo = num;
165 * @return {@inheritDoc}
168 public int getSerialNumber(){
169 return this.rigidSerialNo;
174 * @return {@inheritDoc}
177 public String toString(){
178 StringBuilder result = new StringBuilder();
181 if(this.linkedBone == null){
184 boneName = this.linkedBone.getBoneName().toString();
187 result.append("Rigid(").append(this.rigidName).append(") ");
191 result.append(" [").append(this.rigidShape).append("]");
192 result.append(" ").append(this.position);
193 result.append(" ").append(this.rotation);
194 result.append(" [").append(this.dynamicsInfo).append("]");
195 result.append(" [").append(this.behaviorType).append("]");
197 result.append(" through[");
198 boolean dumped = false;
199 for(RigidGroup group : this.throughGroupColl){
200 if(dumped) result.append(" ");
201 result.append(group.getGroupNumber());
206 return result.toString();